This project contains a React frontend and Express.js backend with PostgreSQL database, all containerized with Docker.
- frontend/ - React application
- backend/ - Express.js API server
- docker-compose.yml - Docker orchestration file
-
Make sure you have Docker and Docker Compose installed
-
Run the entire stack:
docker-compose up --build- Access the applications:
- Frontend: http://localhost:3000
- Backend API: http://localhost:5000
- PostgreSQL: localhost:5432
- Test backend: http://localhost:5000/api/test
- Test database connection: http://localhost:5000/api/db-test
cd frontend
npm install
npm startcd backend
npm install
npm run dev # Uses nodemon for hot reloadPostgreSQL is running in a Docker container with the following credentials:
- Database: myapp
- User: postgres
- Password: postgres
- Port: 5432
GET /- Basic hello messageGET /api/test- API test endpointGET /api/db-test- Database connection testGET /api/users- Get all usersGET /api/users/:id- Get user by IDPOST /api/users- Create new userPUT /api/users/:id- Update userDELETE /api/users/:id- Delete user
cd frontend
npm test # Run tests in watch mode
npm test -- --coverage # Run tests with coveragecd backend
npm test # Run all tests
npm run test:watch # Run tests in watch mode
npm run test:coverage # Run tests with coverage
npm run test:verbose # Run tests with detailed output# Run tests in isolated Docker environment
docker-compose -f docker-compose.test.yml up --buildSee TESTING.md for comprehensive testing documentation.