A full-stack starter template for building modern web applications with SvelteKit frontend and NestJS backend API in a monorepo structure.
- Monorepo Structure: npm workspaces for managing multiple packages
- Frontend: SvelteKit with TypeScript
- Backend: NestJS with TypeScript
- Database: PostgreSQL with Prisma ORM
- API Documentation: Swagger/OpenAPI integration
- Docker Support: Docker and Docker Compose configuration for easy development and deployment
- Railway Deployment: One-click deployment to Railway
- Node.js (v18 or later)
- PostgreSQL database
- Clone the repository:
git clone https://github.com/yourusername/sveltekit-nestjs-starter.git
cd sveltekit-nestjs-starter
- Install dependencies:
npm install
- Set up environment variables:
cp .env.example .env
Update the .env
file with your database credentials and other configuration.
- Start the development servers:
npm run dev
This will start both the frontend and backend in development mode.
You can also use Docker to run the entire application stack:
docker-compose up -d
├── apps/
│ ├── api/ # NestJS backend
│ │ ├── prisma/ # Prisma schema and migrations
│ │ └── src/ # Backend source code
│ └── frontend/ # SvelteKit frontend
│ └── src/ # Frontend source code
├── packages/ # Shared packages
└── docker-compose.yml # Docker configuration
# Start backend in development mode
npm run dev:api
# Run backend tests
npm run test --workspace=apps/api
# Generate Prisma client
cd apps/api && npx prisma generate
# Run database migrations
cd apps/api && npx prisma migrate dev
# Start frontend in development mode
npm run dev:web
# Build frontend for production
npm run build:web
The easiest way to deploy this application is using the Railway button at the top of this README. This will automatically set up all the necessary services.
You can also deploy the application manually:
- Build the application:
npm run build
- Start the production server:
cd apps/api && npm run start:prod
cd apps/frontend && npm run preview
- API Documentation: Access Swagger UI at http://localhost:5000/api when running in development mode
- Frontend Routes:
/
- Home page
- TypeScript type declaration issues: Create global.d.ts with proper type declarations
- Prisma initialization problems: Ensure .env file exists with correct DATABASE_URL
- Value imports being used as types: Use typeof keyword
- Running Prisma in workspace structure: Run commands from /apps/api directory
This project is licensed under the MIT License - see the LICENSE file for details.