A modern, full-stack employee feedback management system built with React and Flask, designed for managers to provide structured feedback to their team members.
# Clone the repository
git clone https://github.com/apocalypse96/feedback-backend.git
cd feedback-backend
# Run with Docker (Recommended)
docker-compose up --build
# Access the application
Frontend: http://localhost:3000
Backend API: http://localhost:5000- Features
- Tech Stack & Design Decisions
- Prerequisites
- Installation & Setup
- Docker Deployment
- API Documentation
- Database Schema
- Cloud Deployment
- Contributing
- License
- π User Authentication: Role-based access control (Manager/Employee)
- π¬ Feedback Management: Create, view, edit, and acknowledge feedback
- π¨οΈ Interactive Comments: Add comments and replies to feedback threads
- π Dashboard Analytics: Visual insights with charts and performance metrics
- π PDF Export: Generate and download professional feedback reports
- π Feedback Requests: Employees can request feedback from their managers
- β‘ Real-time Updates: Dynamic UI updates without page refresh
- π± Responsive Design: Optimized for desktop, tablet, and mobile devices
- π Search & Filter: Advanced filtering and search capabilities
| Technology | Purpose | Why We Chose It |
|---|---|---|
| Flask | Web Framework | Lightweight, flexible, and perfect for RESTful APIs |
| SQLAlchemy | ORM | Type-safe database operations with relationship management |
| PostgreSQL | Database | ACID compliance, scalability, and robust data integrity |
| Gunicorn | WSGI Server | Production-ready with multi-worker support |
| Flask-CORS | Cross-Origin Requests | Secure frontend-backend communication |
| ReportLab | PDF Generation | Professional document generation capabilities |
| Technology | Purpose | Why We Chose It |
|---|---|---|
| React 18 | UI Framework | Modern hooks, concurrent features, and component reusability |
| Recharts | Data Visualization | Lightweight, responsive charts with React integration |
| Axios | HTTP Client | Promise-based requests with interceptors and error handling |
| CSS3 | Styling | Modern layouts with Flexbox/Grid and responsive design |
- ποΈ Microservices Architecture: Separate frontend and backend for scalability
- π RESTful API Design: Standard HTTP methods and consistent response formats
- π§© Component-Based UI: Reusable React components for maintainability
- π Relational Database: Proper foreign keys and data relationships
- π‘οΈ Security First: Input validation, CORS, JWT tokens, and environment variables
- π³ Containerization: Docker for consistent deployment across environments
- β‘ Performance: Lazy loading, optimized queries, and efficient state management
Before you begin, ensure you have the following installed:
- Docker (v20.10+) and Docker Compose (v2.0+)
- Git (v2.30+)
- Node.js (v18+) - Only for local development
- Python (v3.11+) - Only for local development
# 1. Clone the repository
git clone https://github.com/apocalypse96/feedback-backend.git
cd feedback-backend
# 2. Set up environment variables
cp env.example .env
# Edit .env file with your configuration
# 3. Build and start all services
docker-compose up --build
# 4. Access the application
# Frontend: http://localhost:3000
# Backend: http://localhost:5000
# Database: localhost:5432# Navigate to backend directory
cd backend
# Create and activate virtual environment
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
# Set up environment variables
export FLASK_APP=app.py
export FLASK_ENV=development
export SECRET_KEY=your_secret_key_here
export JWT_SECRET_KEY=your_jwt_secret_here
# Initialize database
python -c "from app import db; db.create_all()"
# Run the application
python app.py# Navigate to frontend directory
cd frontend
# Install dependencies
npm install
# Set up environment variables
echo "REACT_APP_API_URL=http://localhost:5000" > .env
# Start development server
npm start# Build backend image
docker build -t feedback-backend .
# Build frontend image
docker build -t feedback-frontend ./frontend
# Run backend container
docker run -p 5000:5000 --env-file .env feedback-backend
# Run frontend container
docker run -p 3000:3000 feedback-frontend# Pull and run the backend image from Docker Hub
docker pull apocalypse96/feedback-backend:latest
docker run -p 5000:5000 apocalypse96/feedback-backend:latest# Set production environment
export FLASK_ENV=production
export DATABASE_URL=postgresql://user:password@host:5432/dbname
# Deploy with production compose file
docker-compose -f docker-compose.prod.yml up -d# Login
POST /api/auth/login
Body: {"email": "user@example.com", "password": "password"}
# Logout
POST /api/auth/logout
Headers: {"Authorization": "Bearer <token>"}# Get all feedback
GET /api/feedback
Headers: {"Authorization": "Bearer <token>"}
# Create feedback
POST /api/feedback
Headers: {"Authorization": "Bearer <token>"}
Body: {"recipient_id": 1, "content": "Great work!", "category": "performance"}
# Update feedback
PUT /api/feedback/<id>
Headers: {"Authorization": "Bearer <token>"}
Body: {"content": "Updated feedback", "status": "acknowledged"}# Get all users
GET /api/users
Headers: {"Authorization": "Bearer <token>"}
# Get user profile
GET /api/users/profile
Headers: {"Authorization": "Bearer <token>"}{
"success": true,
"data": {
"id": 1,
"content": "Excellent presentation skills",
"category": "performance",
"status": "pending",
"created_at": "2024-01-15T10:30:00Z",
"author": {
"id": 2,
"name": "John Manager",
"email": "john@company.com"
}
},
"message": "Feedback retrieved successfully"
}Users (1) ββββ (N) Feedback
β β
β β
ββββ (1:N) ββββ (N:1) ββ Comments
β
βββ (N:1) ββ Users
CREATE TABLE users (
id SERIAL PRIMARY KEY,
email VARCHAR(255) UNIQUE NOT NULL,
name VARCHAR(255) NOT NULL,
password_hash VARCHAR(255) NOT NULL,
role VARCHAR(50) NOT NULL,
manager_id INTEGER REFERENCES users(id),
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);CREATE TABLE feedback (
id SERIAL PRIMARY KEY,
author_id INTEGER REFERENCES users(id) NOT NULL,
recipient_id INTEGER REFERENCES users(id) NOT NULL,
content TEXT NOT NULL,
category VARCHAR(100),
status VARCHAR(50) DEFAULT 'pending',
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);# Manager Account
Email: manager1@company.com
Password: password123
# Employee Accounts
Email: employee1@company.com, employee2@company.com
Password: password123- Fork this repository
- Connect to Vercel
- Set root directory:
frontend - Add environment variable:
REACT_APP_API_URL=https://your-backend.railway.app
- Connect repository to Railway
- Railway auto-detects configuration from
railway.toml - Add PostgreSQL database (automatic)
- Set environment variables:
SECRET_KEY=your_32_character_secret_key JWT_SECRET_KEY=your_jwt_secret_key CORS_ORIGINS=https://your-app.vercel.app FLASK_ENV=production
- Heroku: Use
Procfilefor deployment - Render: Use
render.yamlconfiguration - DigitalOcean: Use Docker droplets
- AWS: ECS with RDS PostgreSQL
See DEPLOYMENT.md for detailed cloud deployment instructions.
# Run backend tests
cd backend
python -m pytest tests/
# Run frontend tests
cd frontend
npm test
# Run integration tests
docker-compose -f docker-compose.test.yml up --abort-on-container-exitβ Star this repository if you found it helpful!
Made with β€οΈ and β by developers, for developers.