A full-stack TypeScript application with Next.js frontend and Express.js backend, running on Docker Compose.
- Frontend: Next.js 16 with App Router
- Backend: Express.js REST API
- Language: TypeScript (strict mode)
- Container: Docker Compose
- CI/CD: GitHub Actions
- Deployment: GitHub Pages (static) or Docker (full stack)
docker compose up --build- Frontend: http://localhost:3001
- Backend API: http://localhost:3000
The app automatically deploys to GitHub Pages when you push to the main branch. The static version shows demo data without requiring a backend.
Setup GitHub Pages:
- Go to your repository Settings → Pages
- Set Source to "GitHub Actions"
- Push to
mainbranch to trigger deployment
GET /- Welcome message and available endpointsGET /health- Health check endpointGET /api/users- Get all usersGET /api/users/:id- Get user by IDPOST /api/users- Create a new user (body:{name, email})
/- Home page with navigation/users- Users list (fetched from API or demo data)/health- API health status (or demo status)
npm install
npm run dev # Development with ts-node
npm run build # Build TypeScript
npm start # Production buildcd frontend
npm install
npm run dev # Development server (requires API running)
npm run build # Production build (static export)
npm start # Production server (only works with standalone)cd frontend
NEXT_PUBLIC_STATIC_MODE=true npm run build
# Output will be in frontend/out/# Terminal 1 - API
npm run dev
# Terminal 2 - Frontend
cd frontend && PORT=3001 npm run devThen visit http://localhost:3001
cd frontend
NEXT_PUBLIC_STATIC_MODE=true npm run build
npx serve outRuns on every push and PR to main:
- ✅ Tests Express API endpoints
- ✅ Tests Next.js build process
- ✅ Integration tests (API + Frontend)
Runs on every push to main:
- 🚀 Builds static site
- 🚀 Deploys to GitHub Pages
- 🚀 Shows demo data (no backend required)
| Mode | Platform | Backend | Data |
|---|---|---|---|
| Full Stack | Docker | ✅ Express API | Live data |
| Static | GitHub Pages | ❌ None | Demo data |
.
├── .github/workflows/ # GitHub Actions
│ ├── test.yml # Test pipeline
│ └── deploy.yml # Deploy to GitHub Pages
├── frontend/ # Next.js frontend
│ ├── src/app/ # App Router pages
│ ├── public/ # Static assets
│ └── out/ # Static export output
├── src/ # Express API
├── docker-compose.yml # Multi-service config
└── package.json # API dependencies