A modern full-stack web application built with SvelteKit frontend and Express backend, using PostgreSQL with Drizzle ORM.
- Frontend: SvelteKit with Node.js adapter for custom server integration
- Backend: Express.js with PostgreSQL and Drizzle ORM
- Database: PostgreSQL running in Docker
- Database Management: Adminer for database visualization
-
Clone and setup the project:
git clone <your-repo> cd danegg bun run setup
-
Start the database:
bun run db:up
-
Set up the database schema:
bun run db:push
-
Start the development servers:
bun run dev
-
Access the application:
- Frontend: http://localhost:3000
- Backend API: http://localhost:3000/api/*
- Database Admin: http://localhost:8080 (Adminer)
bun run dev- Start both frontend and backend in development modebun run frontend:dev- Start only the frontendbun run backend:dev- Start only the backend
bun run build- Build both frontend and backendbun run start- Start the production server
bun run db:up- Start PostgreSQL and Adminer containersbun run db:down- Stop database containersbun run db:generate- Generate database migrationsbun run db:push- Push schema changes to databasebun run db:studio- Open Drizzle Studio
danegg/
βββ frontend/ # SvelteKit application
βββ backend/ # Express API server
β βββ src/
β β βββ db/ # Database schema and connection
β β βββ index.ts # Main server file
β βββ package.json
βββ server.js # Custom server combining both
βββ docker-compose.dev.yml # Database setup
βββ package.json # Root package management
GET /api/health- Health check with uptime and timestamp
The application includes example users and posts tables. You can modify the schema in backend/src/db/schema.ts and run bun run db:push to apply changes.
Copy .env.example.dev to .env for local development (or .env.example.prod for Docker production β see docker-compose.yml):
cp .env.example.dev .envKey variables:
DATABASE_URL- PostgreSQL connection stringPORT- Server port (default: 3000)HOST- Server host (default: 0.0.0.0)
- Make changes to the frontend in
frontend/src/ - Make changes to the backend in
backend/src/ - Database changes go in
backend/src/db/schema.ts - Run
bun run db:pushafter schema changes - Both servers auto-reload during development
The custom server in server.js combines both SvelteKit and ElysiaJS, making it easy to deploy as a single container. Build the project and run the server:
bun run build
bun run start