Skip to content

Setting up a new project is time-consuming. The purpose of this project is to make it effortless with state-of-the-art technology and tooling.

Notifications You must be signed in to change notification settings

brandhaug/full-stack-typescript-monorepo-starter-with-authentication

Repository files navigation

Full-stack TypeScript Monorepo Starter with Authentication

Setting up a new project is time-consuming. The purpose of this project is to make it effortless with state-of-the-art technology and tooling.

In short - it's a monorepo with Node.js backend, GraphQL API, and React frontend. The whole stack is with TypeScript.

1 Features

1.1 Backend

1.2 Frontend

1.3 Tooling/Infrastructure

2 Setup

2.1 Server

  1. Install Docker Compose
  2. Install dependencies in all projects: pnpm install --recursive
  3. Build types from GraphQL schema: pnpm run graphql-codegen
  4. Create the file server/.env.development and add the fields from server/.env.example
  5. Run DB: docker-compose up db
  6. Migrate DB schema: npx prisma migrate dev in server
  7. Generate types: npx prisma generate in server
  8. Run server: pnpm run dev --prefix server

2.2 App

  1. Create the file app/.env.development and add the fields from app/.env.example:
  2. Run app: pnpm run dev --prefix app

3. Maintenance and further development

3.1 Database

  • Edit DB schema in server/prisma/schema.prisma
  • Migrate DB schema by running npx prisma migrate dev in server
  • Generate types by running npx prisma generate in server
  • Open DB admin panel by running npx prisma studio in server

3.2 API

  • Generate types by running pnpm run graphql-codegen
  • Edit GraphQL Schema in server/src/schema.graphql
  • Open GraphiQL in localhost:4000 while running server

3.3 Translations

  • Run pnpm run extract-translations in app
  • Edit json files in app/src/assets/translations

3.4 Testing

  • Run tests with pnpm run test --recursive

4. Deploy

4.1 Railway

Deploy on Railway

  • Configure deploys in server/railway.toml and app/railway.toml
  • Setup environment variables based on .env.example in each folder
  • Add RAILWAY_TOKEN to GitHub actions secret

4.2 Turborepo