This is a full-stack Todo application built with a React frontend, an Express backend, and PostgreSQL as the database. The application allows users to manage their todo items with features such as adding, deleting, and marking items as complete. The frontend is styled using Tailwind CSS for a modern and responsive design.
devops-demo/
├── client/ # React frontend with Vite
│ ├── Dockerfile # Multi-stage Docker configuration for client
│ ├── public/ # Public assets
│ ├── src/ # Source files for React
│ │ ├── components/ # React components
│ │ ├── context/ # React context providers
│ │ ├── hooks/ # Custom React hooks
│ │ └── services/ # API and mock services
│ ├── vite.config.js # Vite configuration
│ └── package.json # npm configuration for client
├── server/ # Express backend
│ ├── Dockerfile # Multi-stage Docker configuration for server
│ ├── src/ # Source files for Express
│ │ ├── config/ # Configuration files
│ │ ├── controllers/ # API controllers
│ │ ├── models/ # Database models
│ │ ├── routes/ # API routes
│ │ └── tests/ # Test files
│ └── package.json # npm configuration for server
├── e2e/ # End-to-end tests with Playwright
│ ├── Dockerfile # Docker configuration for e2e tests
│ ├── tests/ # E2E test files
│ └── playwright.config.js # Playwright configuration
├── nginx/ # Nginx configuration for reverse proxy
│ ├── Dockerfile # Nginx Dockerfile
│ ├── default.conf # Production Nginx configuration
│ └── local.conf # Development/Test Nginx configuration
├── docker-compose.dev.yml # Docker Compose for development
├── docker-compose.test.yml # Docker Compose for testing
├── docker-compose.prod.yml # Docker Compose for production
├── docker-compose.deploy.yml # Docker Compose for deployment
└── README.md # Project documentation
- Add new todo items with a title
- Mark todo items as complete using a checkbox
- Delete todo items from the list
- Responsive design using Tailwind CSS
- REST API with Express.js backend
- PostgreSQL database for data persistence
- Containerized with Docker for easy development, testing, and deployment
- Nginx reverse proxy for production-ready setup
- End-to-end testing with Playwright
- Support for local development with mock API
- Node.js (v16+) and npm
- Docker and Docker Compose
- Git
- Clone the repository:
git clone <repository-url> cd devops-demo
Run the application in development mode with hot-reloading:
docker-compose -f docker-compose.dev.yml up --build
Access the application:
- Frontend: http://localhost:3000
- Backend API: http://localhost:5000/api/todos
Run the application with end-to-end tests:
docker-compose -f docker-compose.test.yml up --build
This will:
- Build and start the application in a production-like environment
- Start the Playwright E2E tests against the running application
- Generate test reports in
e2e/playwright-report
ande2e/test-results
Build and run the application in production mode:
docker-compose -f docker-compose.prod.yml up --build
Access the application:
- Application: http://localhost:80 (through Nginx)
For deployment to a remote server:
docker-compose -f docker-compose.deploy.yml up -d
cd client
npm install
npm run dev
By default, the frontend will use the mock API when running locally.
cd server
npm install
npm run dev
Make sure to set up PostgreSQL locally and update the environment variables.
# Client tests
cd client
npm test
# Server tests
cd server
npm test
cd e2e
npm install
npm test
VITE_USE_MOCK_API
: Set tofalse
to use the real API instead of the mock APIVITE_API_URL
: URL for the API endpoint
NODE_ENV
: Environment (development
,test
, orproduction
)DB_HOST
: PostgreSQL hostDB_USER
: PostgreSQL usernameDB_PASSWORD
: PostgreSQL passwordDB_NAME
: PostgreSQL database nameDB_LOGGING
: Enable/disable SQL query logging
This project is licensed under the MIT License.