A full-stack TypeScript monorepo featuring a Next.js 15 frontend and Express.js backend with Prisma ORM and PostgreSQL database. Built with modern development tools including Storybook, Vitest, and comprehensive linting/formatting setup.
NOTE: This repo uses ports 3030-3039 to avoid collisions with other projects you may have running.
Service | Port |
---|---|
Next.js (Web app) | 3030 |
Express (Server) | 3031 |
Storybook | 3036 |
- Node.js 18+
- pnpm 8+
- PostgreSQL database (configured in
apps/server/.env
)
- Install dependencies:
pnpm install
- Set up the database:
# Push the schema to your database
pnpm db:push
# Or run migrations (for production)
pnpm db:migrate
- Generate Prisma client:
pnpm db:generate
- Start development servers:
# Start both web and server
pnpm dev
# Or start individually
pnpm dev:web # Next.js on http://localhost:3030
pnpm dev:server # Express on http://localhost:3031
├── apps/
│ ├── web/ # Next.js 15 frontend (TypeScript, Tailwind)
│ └── server/ # Express.js backend (TypeScript, Prisma)
├── packages/ # Shared packages (if any)
├── pnpm-workspace.yaml
└── package.json
pnpm dev
- Start both applications in development modepnpm dev:web
- Start Next.js frontend only (port 3030)pnpm dev:server
- Start Express backend only (port 3031)pnpm storybook
- Start Storybook development server (port 3036)
pnpm build
- Build all applications for productionpnpm start
- Start all applications in production mode
pnpm test
- Run all testspnpm test:ui
- Run tests with interactive UIpnpm test:coverage
- Run tests with coverage reportpnpm test:watch
- Run tests in watch mode
pnpm lint
- Lint all applicationspnpm type-check
- TypeScript type checking across all appspnpm format
- Format code with Prettierpnpm format:check
- Check code formatting
pnpm db:generate
- Generate Prisma clientpnpm db:push
- Push schema to database (development)pnpm db:migrate
- Run Prisma migrations (production)pnpm db:studio
- Open Prisma Studio GUI
Create apps/server/.env
file and configure:
DATABASE_URL="postgresql://username:password@localhost:5432/database_name"
PORT=3031
Note: Make sure your PostgreSQL database is running and accessible before starting the server.
All API endpoints are versioned with /api/v1
prefix:
GET /api/v1/health
- Health check
GET /api/v1/users
- Get all usersGET /api/v1/users/:id
- Get user by IDPOST /api/v1/users
- Create a new userPUT /api/v1/users/:id
- Update userDELETE /api/v1/users/:id
- Delete user
GET /api/v1/specials
- Get all specialsGET /api/v1/specials/active
- Get only active specialsGET /api/v1/specials/:id
- Get special by IDPOST /api/v1/specials
- Create a new specialPUT /api/v1/specials/:id
- Update specialDELETE /api/v1/specials/:id
- Delete special
- Framework: Next.js 15 with App Router
- Styling: Tailwind CSS v4
- Components: Storybook for development and testing
- Testing: Vitest with Playwright for browser testing
- Language: TypeScript
The server includes comprehensive testing with:
- Unit Tests: Services tested with mocked Prisma client
- Integration Tests: Controllers tested with dependency injection
- Coverage: 81%+ code coverage with detailed reporting
- Colocated Tests: Test files placed next to source files
- Fast Execution: Vitest provides rapid test feedback
See apps/server/TEST_SETUP.md
for detailed testing documentation.
The backend follows MVC (Model-View-Controller) architecture:
src/
├── controllers/ # HTTP request handlers
├── services/ # Business logic layer
├── routes/ # API route definitions
├── lib/ # Shared utilities (Prisma client)
└── index.ts # Express server entry point
- Framework: Express.js with TypeScript
- Database: PostgreSQL with Prisma ORM
- API: RESTful API with
/api/v1
prefix - Models: User and Special with full CRUD operations
- Testing: Vitest with Supertest for HTTP testing and comprehensive mocking
Layer | Technology |
---|---|
Frontend | Next.js 15, React 19, Tailwind CSS |
Backend | Express.js, Node.js |
Database | PostgreSQL, Prisma ORM |
Development | TypeScript, ESLint, Prettier |
Testing | Vitest, Supertest, Playwright, Storybook |
Package Manager | pnpm with workspaces |
🚀 Learn web development for free at The Road To Dev!