A modern task management application built with React, Node.js, TypeScript, and PostgreSQL. Features include CRUD operations for tasks, file upload/download capabilities, user authentication, and deployment to Google Cloud Platform.
- User Authentication: Secure JWT-based authentication
- Task Management: Create, read, update, and delete tasks
- File Management: Upload and download files with Google Cloud Storage integration
- Modern UI: Responsive design built with React and Tailwind CSS
- Real-time Updates: Optimistic updates with React Query
- Cloud Deployment: Containerized deployment to Google Cloud Run
- CI/CD Pipeline: Automated deployment with GitHub Actions
- Runtime: Node.js with TypeScript
- Framework: Express.js
- Database: PostgreSQL with Prisma ORM
- Authentication: JWT tokens
- File Storage: Google Cloud Storage
- Validation: Joi schema validation
- Framework: React 18 with TypeScript
- Build Tool: Vite
- Styling: Tailwind CSS
- State Management: React Query
- Routing: React Router
- Forms: React Hook Form
- Containerization: Docker & Docker Compose
- Cloud Platform: Google Cloud Platform
- CI/CD: GitHub Actions
- Database: Google Cloud SQL (PostgreSQL)
- Storage: Google Cloud Storage
- Node.js 18+
- Docker and Docker Compose
- Google Cloud Platform account (for deployment)
- Git
git clone <your-repository-url>
cd gcptest
# Start all services
docker-compose up -d
# View logs
docker-compose logs -f
# Stop services
docker-compose down
The application will be available at:
- Frontend: http://localhost:3000
- Backend API: http://localhost:3001
- Database: postgresql://postgres:postgres123@localhost:5432/taskmanager
- Setup Backend
cd backend
npm install
cp env.example .env
# Edit .env with your database and other configurations
npx prisma migrate dev
npm run dev
- Setup Frontend
cd frontend
npm install
npm run dev
Create .env
files based on the examples:
Backend (.env)
DATABASE_URL="postgresql://username:password@localhost:5432/taskmanager?schema=public"
JWT_SECRET="your-super-secret-jwt-key"
JWT_EXPIRES_IN="7d"
PORT=3001
NODE_ENV="development"
GOOGLE_CLOUD_PROJECT_ID="your-gcp-project-id"
GOOGLE_CLOUD_STORAGE_BUCKET="your-storage-bucket"
GOOGLE_APPLICATION_CREDENTIALS="path/to/service-account-key.json"
FRONTEND_URL="http://localhost:5173"
# Build and start all services
docker-compose up --build
# Run in background
docker-compose up -d
# View service logs
docker-compose logs -f [service-name]
# Stop all services
docker-compose down
# Remove volumes (β οΈ This will delete database data)
docker-compose down -v
# Build backend image
cd backend
docker build -t taskmanager-backend .
# Build frontend image
cd frontend
docker build -t taskmanager-frontend .
- Google Cloud Setup
# Install Google Cloud CLI
# https://cloud.google.com/sdk/docs/install
# Login and set project
gcloud auth login
gcloud config set project YOUR_PROJECT_ID
# Enable required APIs
gcloud services enable run.googleapis.com
gcloud services enable sql-component.googleapis.com
gcloud services enable storage-component.googleapis.com
gcloud services enable artifactregistry.googleapis.com
- Create Service Account
# Create service account
gcloud iam service-accounts create taskmanager-sa \
--display-name="Task Manager Service Account"
# Grant necessary roles
gcloud projects add-iam-policy-binding YOUR_PROJECT_ID \
--member="serviceAccount:taskmanager-sa@YOUR_PROJECT_ID.iam.gserviceaccount.com" \
--role="roles/cloudsql.client"
gcloud projects add-iam-policy-binding YOUR_PROJECT_ID \
--member="serviceAccount:taskmanager-sa@YOUR_PROJECT_ID.iam.gserviceaccount.com" \
--role="roles/storage.admin"
# Create and download key
gcloud iam service-accounts keys create key.json \
--iam-account=taskmanager-sa@YOUR_PROJECT_ID.iam.gserviceaccount.com
- Repository Secrets
Add these secrets to your GitHub repository:
GCP_PROJECT_ID: your-google-cloud-project-id
GCP_SA_KEY: <contents-of-service-account-key.json>
DATABASE_URL: postgresql://username:password@/taskmanager?host=/cloudsql/PROJECT_ID:REGION:INSTANCE_NAME
DB_PASSWORD: secure-database-password
JWT_SECRET: super-secure-jwt-secret-for-production
- Trigger Deployment
Push to the main
branch to trigger automatic deployment:
git add .
git commit -m "Deploy to Google Cloud"
git push origin main
# Build and push images
./scripts/deploy.sh
POST /api/auth/register - Register new user
POST /api/auth/login - Login user
GET /api/auth/me - Get current user
PUT /api/auth/profile - Update user profile
GET /api/tasks - Get all tasks
GET /api/tasks/:id - Get single task
POST /api/tasks - Create new task
PUT /api/tasks/:id - Update task
DELETE /api/tasks/:id - Delete task
GET /api/tasks/stats/overview - Get task statistics
GET /api/files - Get all files
GET /api/files/:id - Get file metadata
POST /api/files/upload - Upload file
GET /api/files/:id/download - Download file
DELETE /api/files/:id - Delete file
PUT /api/files/:id/attach/:taskId - Attach file to task
PUT /api/files/:id/detach - Detach file from task
# Backend tests
cd backend
npm test
# Frontend tests
cd frontend
npm test
# E2E tests
npm run test:e2e
gcptest/
βββ backend/ # Node.js backend
β βββ src/
β β βββ routes/ # API routes
β β βββ middleware/ # Express middleware
β β βββ utils/ # Utility functions
β β βββ index.ts # Application entry point
β βββ prisma/ # Database schema and migrations
β βββ Dockerfile # Backend container config
β βββ package.json
βββ frontend/ # React frontend
β βββ src/
β β βββ components/ # React components
β β βββ pages/ # Page components
β β βββ contexts/ # React contexts
β β βββ lib/ # Utilities and API client
β β βββ types/ # TypeScript type definitions
β βββ Dockerfile # Frontend container config
β βββ package.json
βββ .github/workflows/ # GitHub Actions CI/CD
βββ docker-compose.yml # Local development setup
βββ README.md
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
If you encounter any issues or have questions:
- Check the Issues section
- Create a new issue with detailed information
- Contact the development team
- β Development Environment
- β Docker Containerization
- β Google Cloud Ready
- β CI/CD Pipeline
- β Production Deployment
Built with β€οΈ using modern web technologies