Full-stack authentication system with user and admin functionalities using Node.js, Express, PostgreSQL, and React. Deployed using GitHub Container Registry (GHCR) and GitHub Actions for CI/CD.
- User registration and login
- Role-based access control
- Password management
- User session handling
- Admin dashboard
- Automated container builds and deployments
- Version-controlled Docker images
- Backend: Node.js, Express, PostgreSQL
- Frontend: React, TypeScript
- Containerization: Docker, Docker Compose
- CI/CD: GitHub Actions
- Container Registry: GitHub Container Registry (GHCR)
- Docker
- Docker Compose
- GitHub Account with Container Registry access
- Clone the repository
- Create a
.envfile in the root directory (see Environment Variables section) - Run:
docker compose up
- Clone the repository
- Create a
.envfile in the root directory - Run:
docker compose up --build
All Docker images are automatically built and pushed to GitHub Container Registry:
- Frontend:
ghcr.io/<username>/nodeauth-frontend:latest - Backend:
ghcr.io/<username>/nodeauth-backend:latest - Database:
ghcr.io/<username>/nodeauth-postgres:latest
Create a .env file in the root directory with the following variables:
# GitHub Container Registry
GITHUB_USER=your-github-username
# Database Configuration
POSTGRES_USER=your-db-user
POSTGRES_PASSWORD=your-secure-password
POSTGRES_DB=your-db-name
# Backend Configuration
SERVER_PORT=6060
CLIENT_URL=http://localhost:5173
SESSION_SECRET=your-secure-session-secretThe project uses GitHub Actions for automated builds and deployments:
- Triggers on push to main branch
- Builds Docker images for all services
- Pushes images to GitHub Container Registry
- Tags images with both 'latest' and commit SHA
Three containerized services:
- PostgreSQL database (Port 5432)
- Backend service (Port 6060)
- Frontend service (Port 5173)
- Password hashing with bcrypt
- Input validation
- Role-based access control
- Secure session management
- Environment variable management
- Containerized services
- Frontend:
http://localhost:5173 - Backend API:
http://localhost:6060
To contribute or modify:
- Fork the repository
- Create a feature branch
- Make changes
- Create a pull request
- Ensure you have a GitHub Personal Access Token with
write:packagesscope - Login to GHCR:
docker login ghcr.io -u YOUR_GITHUB_USERNAME -p YOUR_GITHUB_PAT- Ensure all required GitHub secrets are configured
- Check Docker and Docker Compose installations
- Verify environment variables in
.envfile - Confirm GitHub Container Registry access
