Giter Club home page Giter Club logo

svelte-trpc-skeleton's Introduction

Fullstack example project with Svelte/Vite, Fastify & tRPC all in typescript.

As a showcase Login functionality via cookie/server-sessions.

If you like video tutorials, https://www.youtube.com/watch?v=Lam0cYOEst8 walks you through a pretty similar setup (just with slightly different technologies like express, react, yarn workspaces, etc..).

Note: I'm not intending to update this a lot in the furture, but if you have meaningful contributions (like unifying the typescript setup or an env setup for real production) i happily accept pull requests!

A bit more thoughts on the setup at https://dev.to/o_a_e/fullstack-with-svelte-trpc-2cab.

Project Structure

It's a very simple monorepo setup with NPM workspaces. The frontend and backend folders are separated node modules, the root module just calls the relevant sub-modules tasks for convenience.

  • frontend contains a typical Svelte/Vite setup which could be used and operated standalone.
  • backend has a minimal fastify HTTP server and the actual backend logic is crafted in tRPC.

Development

During development 2 servers are started. Each one is refreshed/restarted automatically on relevant file changes.

  • There is a standalone backend server (fastify).
  • There is a standalone Vite server hosting the frontend. The frontend makes calls to the separate backend server.
  • So you have to navigate to http://127.0.0.1:5173 to use the app.

Production

  • Frontend files are compiled to /client/dist.
  • Backend hosts the logic but also serves the client files.
  • So you have to navigate to http://127.0.0.1:3000 to use the app.

Build

  • npm install - Install node modules for all packages
  • npm run dev - Starts the development servers (Use http://127.0.0.1:5173 for using the app)
  • npm run start - Start production server (Use http://127.0.0.1:3000 for using the app)

svelte-trpc-skeleton's People

Contributors

jzillmann 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.