A fullstack application with Next.js frontend and Express.js backend, containerized with Docker.
.
├── frontend/ # Next.js frontend application
│ ├── app/ # Next.js app directory
│ ├── components/ # React components
│ ├── lib/ # Utility functions
│ ├── public/ # Static assets
│ ├── Dockerfile # Docker configuration for frontend
│ └── package.json # Frontend dependencies
├── backend/ # Express.js backend application
│ ├── src/ # Source code
│ │ ├── controllers/ # Route controllers
│ │ ├── routes/ # API routes
│ │ ├── middleware/ # Custom middleware
│ │ └── index.ts # Application entry point
│ ├── Dockerfile # Docker configuration for backend
│ └── package.json # Backend dependencies
├── docker-compose.yml # Docker Compose configuration
└── README.md # This file
- Docker
- Docker Compose
- Clone the repository
- Navigate to the project root
- Run the following command:
docker-compose up --buildThis will:
- Build both frontend and backend Docker images
- Start both services
- Expose the frontend on
http://localhost:3000 - Expose the backend on
http://localhost:5000
cd frontend
npm install
npm run devThe frontend will be available at http://localhost:3000
cd backend
npm install
npm run devThe backend will be available at http://localhost:5000
GET /- Welcome messageGET /api/health- Health check endpoint
- Next.js 14
- React 18
- TypeScript
- TailwindCSS
- Express.js
- TypeScript
- CORS
- Docker
- frontend: Next.js application running on port 3000
- backend: Express.js API running on port 5000
Create a .env file in the backend directory based on .env.example:
PORT=5000
NODE_ENV=development
Environment variables can be set in docker-compose.yml or in the Next.js configuration.
To stop the Docker containers:
docker-compose downTo stop and remove volumes:
docker-compose down -v- The frontend uses Next.js App Router
- The backend is built with TypeScript and Express
- Both services are containerized for easy deployment
- Docker Compose handles service orchestration and networking