Git Product home page Git Product logo

iq-scm / rusve Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mpiorowski/rusve

0.0 0.0 0.0 3.55 MB

Open source application build using SvelteKit with Rust and Go as microservices connected via gRPC.

Home Page: https://www.rusve.app

License: MIT License

Shell 0.13% JavaScript 1.32% Go 2.39% Rust 58.27% TypeScript 16.18% CSS 0.39% HTML 0.12% PLpgSQL 0.22% Dockerfile 0.50% Svelte 20.47%

rusve's Introduction

Welcome to Rusve!

What is Rusve?

It is a attempt to find the best way to build fast and scalable web applications, while not beeing afraid of new technologies. And I think we are getting there.

Feel free to ask questions and throw new ideas! Any contribution is also welcome, especially some ux/ui redesigns :)

Currently working on...

  • Markdown
  • Telemetry
  • Make it more resistanc to no js
  • Any other feature You will request :)

Application

https://www.rusve.app

CMS

https://directus-cms.fly.dev | Login: [email protected] | Password: d1r3ctu5

Features

  • Backend
    • Microservices - Splitted into smaller parts, very easy to scale, and allows using any combination of languages and databases. Project have ready to use both Go and Rust services.
    • Go - Very easy to work with while still having an amazing performance. Out of the box support for gRPC. Recommended to start with.
    • Rust - For more complex services use Rust, hard but amazing language. Almost impossible to write code that will not start.
    • gRPC - Connection between services using gRPC, which is very fast and gives an option for bi-directional streaming. For Rust using great Tonic create, with first class support of async/await.
    • Typesafety - Thanks to protobuf, amazing typesafety across the whole project, no matter the language (not only for TS, hi tRPC).
    • Sql Pools and Transactions - Using the best practice for the best performance and error handling.
    • Dockerized - Every service is dockerized. Local build ready with one command.
  • Frontend
    • SvelteKit - Once You try it, it's hard to go back to any other framework.
    • Typescript - Fully written in typescript with the strict rules enforced. No any or unknown in code.
    • Form actions - Forms are handled by server, which force You to seperate view and logic. This is a great pattern and makes the logic unaccesible by the browser.
    • Zod validation - Every data if validated. Errors are returned and used by client to view them on forms.
    • Streaming - Important data is loaded and rendered first, after that all the rest are returned as promises and rendered when they resolve.
    • PWA with service workers - Turn off the internet and check how resiliant the app is.
    • Firebase SSR Authentication - Battle-tested OAuth, Magic Link, Phone Number. And by doint it on Svelte server, it's much more secure.
    • TailwindCSS - Used for styling, no other UI library needed.
    • Minimal external libraries - With Svelte animation and stores builing custom components is very easy. Checkout Toast, Drawer, Modal, Dropdown and see for yourself.
  • Deployment
    • Github Action - Ready to use github actions for deployment, each service is linted and checked. Possible to deploy all services or a single one.
    • Google Cloud Platform - Easy to deploy, easy to scale, easy to maintain, and still cheap.
    • Google Cloud Run - Thanks to dockerized application, it's very easy to deploy. Scaling done automatically, can set the min. instances to 1 to reduce cold start.
    • Google Cloud Storage - Working files upload, download and delete.
    • Google PubSub - Asynchronus data sending.
  • Additional features
    • Stripe - Fully working subscription flow.
    • HeadlessCMS - Headless cms via Directus.
    • WYSIWYG - Wyswig text editor thanks to TipTap.

Architecture

image

Authorization

image

Github action deployment

Release all

image

Release single

image

Aria and PWA with offline service workers

image

Dev deployment

  1. Client setup
cp client/.env.example client/.env
npm i --prefix client
  1. Run proto generation Be sure to have protoc installed.
sh proto.sh
  1. Fill in missing firebase secrets in client/.env
  • STRIPE_API_KEY
  • PUBLIC_API_KEY
  • PUBLIC_AUTH_DOMAIN
  • SERVICE_ACCOUNT

Getting the SERVICE_ACCOUNT key is a bit tricky.

  1. Start docker:
docker-compose up --build
  1. Access:

Application - http://localhost:3000
CMS - http://localhost:8055 | Login: [email protected] | Password: d1r3ctu5

Production deployment

  1. Go through each deploy-***.yml and change env acording to Your project.

  2. Add secrets to github

  • GCP_CREDENTIALS
  • DB_PASS
  • STRIPE_API_KEY
  • SENDGRID_API_KEY
  • PUBLIC_API_KEY
  • PUBLIC_AUTH_DOMAIN
  • SERVICE_ACCOUNT
  1. Add proper IAM permissions

image

Bonus: Three ways to shows notes. Not implemented in application, but all the code is there to try it.

This project shows how flexible the gRPC + SvelteKit setup is, using the newest SvelteKit streamed feature. There are three ways to display notes:

  1. svelte server calls notes service -> notes service selects all notes -> for each note it calls users service for user -> the note with the user is returned as stream
  2. svelte server calls notes service -> notes service selects all notes and return them -> for each note svelte server calls users service for user -> not waiting for users to resolve, he dispaly the notes, and after that await users as streamed data
  3. svelte server calls notes service -> notes service selects all notes and return them -> for each note svelte server add userId to set -> then, in one request he calls users service for all users -> not waiting for users to resolve, he displays notes and after that await users as streamed data

rusve's People

Contributors

dependabot[bot] avatar mpiorowski avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.