A full-stack web application with secure user authentication, built with modern technologies and best practices.
Choose your preferred setup method:
- πͺ Windows:
.\start-windows.bat - π§ Linux:
./start-linux.sh - π macOS:
./start-macos.sh
- Windows:
.\start-auto.bat - Unix-like:
./start-auto.sh
docker-compose up --buildExpected Results:
- β Frontend: http://localhost:3000
- β Backend API: http://localhost:8000
- β API Docs: http://localhost:8000/docs
π For detailed Docker setup and troubleshooting, see DOCKER_SETUP.md
- User Authentication: Registration, login, logout with JWT tokens
- Secure Backend: FastAPI with PostgreSQL database
- Modern Frontend: React with Vite and Tailwind CSS
- Protected Routes: Dashboard accessible only to authenticated users
- Profile Management: View and edit user profiles
- Responsive Design: Beautiful UI that works on all devices
- Real-time Validation: Form validation with error handling
- Token Management: Automatic token refresh and secure logout
- Framework: FastAPI (Python)
- Database: PostgreSQL with SQLAlchemy ORM
- Authentication: JWT (JSON Web Tokens)
- Password Security: bcrypt hashing
- Migrations: Alembic
- Validation: Pydantic schemas
- Framework: React 18
- Build Tool: Vite
- Styling: Tailwind CSS
- Routing: React Router v6
- HTTP Client: Axios
- Forms: React Hook Form
- Notifications: React Hot Toast
- Icons: Heroicons
LoginSampleApp/
βββ backend/ # FastAPI backend application
β βββ app/ # Application source code
β β βββ auth/ # Authentication utilities
β β βββ models/ # Database models
β β βββ routes/ # API route handlers
β β βββ schemas/ # Pydantic validation schemas
β β βββ middleware/ # Custom middleware
β βββ alembic/ # Database migrations
β βββ requirements.txt # Python dependencies
β βββ .env.example # Environment variables template
β βββ start.sh # Backend startup script
βββ frontend/ # React frontend application
β βββ src/ # Application source code
β β βββ components/ # Reusable UI components
β β βββ pages/ # Page components
β β βββ context/ # React context providers
β β βββ services/ # API service layer
β β βββ hooks/ # Custom React hooks
β β βββ utils/ # Utility functions
β βββ package.json # Node.js dependencies
β βββ .env.example # Environment variables template
β βββ start.sh # Frontend startup script
βββ docs/ # Documentation
βββ .gitignore # Git ignore rules
βββ README.md # This file
One-command setup - No local dependencies required!
# Clone repository
git clone https://github.com/AmzurATG/LoginSampleApp.git
cd LoginSampleApp
# Start entire application with Docker
./start.shAccess the application:
- Frontend: http://localhost:3000
- Backend API: http://localhost:8000
- API Documentation: http://localhost:8000/docs
See DOCKER_GUIDE.md for detailed Docker instructions.
For developers who want to run without Docker:
- Docker and Docker Compose
- Git for version control
- Python 3.8+ for backend
- Node.js 16+ for frontend
- PostgreSQL database (if not using Docker)
- Git for version control
git clone <your-repository-url>
cd LoginSampleAppDocker provides the easiest way to run the complete application stack. All dependencies, database, and services are automatically configured.
- Docker Desktop (Windows/macOS) or Docker + Docker Compose (Linux)
- Git for cloning the repository
# Clone the repository
git clone <repository-url>
cd LoginSampleApp
# Choose your preferred method:
.\start-windows.bat # Windows
./start-linux.sh # Linux
./start-macos.sh # macOS
./start-auto.sh # Auto-detection (Unix)
.\start-auto.bat # Auto-detection (Windows)Access Points:
- π Frontend: http://localhost:3000
- π§ Backend API: http://localhost:8000
- π API Docs: http://localhost:8000/docs
π For detailed Docker setup, troubleshooting, and advanced configurations, see docker-setup/DOCKER_SETUP.md
# Stop all services
docker-compose -f docker-setup/windows/docker-compose.windows.yml down # Windows
docker-compose -f docker-setup/linux/docker-compose.linux.yml down # Linux
docker-compose -f docker-setup/macos/docker-compose.macos.yml down # macOS
# Restart services
.\start-windows.bat # Windows
./start-linux.sh # Linux
./start-macos.sh # macOS# Windows
docker-compose -f docker-setup/windows/docker-compose.windows.yml down
docker rmi windows-backend:latest windows-frontend:latest postgres:15
docker volume rm windows_postgres_data
docker system prune -f
# Linux/macOS
docker-compose down
docker rmi linux-backend:latest linux-frontend:latest postgres:15 # or macos-*
docker volume rm linux_postgres_data # or macos_postgres_data
docker system prune -fπ For complete cleanup instructions and troubleshooting, see docker-setup/DOCKER_SETUP.md
cd backend
# Create virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
# Setup environment variables
cp .env.example .env
# Edit .env with your database credentials
# Setup database
./setup_db.sh
# Start backend server
./start.shThe backend will be available at:
- API: http://localhost:8000
- API Docs: http://localhost:8000/docs
cd frontend
# Install dependencies
npm install
# Setup environment variables
cp .env.example .env
# Edit .env if needed (default should work)
# Start development server
npm run devThe frontend will be available at: http://localhost:5173
- Access the Application: Open http://localhost:5173 in your browser
- Register: Create a new account with email and password
- Login: Sign in with your credentials
- Dashboard: Access your profile and account settings
- Profile Management: Update your personal information
- Logout: Securely sign out of your account
- Password Hashing: bcrypt with salt for secure password storage
- JWT Authentication: Stateless token-based authentication
- Token Expiration: Automatic token refresh and logout
- Input Validation: Comprehensive validation on both frontend and backend
- CORS Protection: Configured allowed origins
- SQL Injection Protection: SQLAlchemy ORM with parameterized queries
- Secure Headers: HTTP security headers implemented
cd backend
python test_api.pycd frontend
npm run test # If tests are implemented- Visit http://localhost:8000/docs for interactive API documentation
- Use the frontend application for end-to-end testing
git clone https://github.com/AmzurATG/LoginSampleApp.git
cd LoginSampleApp
./start.sh# Start all services
docker-compose up -d
# View logs
docker-compose logs -f
# Stop services
docker-compose down- β Frontend: React app with Nginx (Port 3000)
- β Backend: FastAPI with auto-migrations (Port 8000)
- β Database: PostgreSQL with persistent storage (Port 5432)
- β Health Checks: Automatic service monitoring
- β One Command Setup: No local dependencies needed
See DOCKER_GUIDE.md for comprehensive Docker documentation.
For Docker (.env):
# Database
POSTGRES_PASSWORD=postgres
# Backend
SECRET_KEY=your-super-secret-key-change-this-in-production-make-it-very-long-and-random
ENVIRONMENT=development
# Frontend
VITE_API_BASE_URL=http://localhost:8000
# CORS
ALLOWED_ORIGINS=http://localhost:3000,http://localhost:5173,http://localhost:80Backend (.env) (for local development):
DATABASE_URL=postgresql://user:password@host:port/database
SECRET_KEY=your-production-secret-key-min-32-characters
ENVIRONMENT=production
ALLOWED_ORIGINS=https://yourdomain.comFrontend (.env) (for local development):
VITE_API_BASE_URL=https://api.yourdomain.com- Change default secret keys
- Use HTTPS in production
- Configure proper CORS origins
- Set up database connection pooling
- Implement rate limiting
- Set up monitoring and logging
- Use non-root users in Docker containers
- Keep Docker images updated
- Scan Docker images for vulnerabilities
- Enable database backups
- Configure firewall rules
POST /api/auth/register- Register new userPOST /api/auth/login- User loginPOST /api/auth/refresh- Refresh access token
GET /api/users/me- Get current user profilePUT /api/users/me- Update user profileDELETE /api/users/me- Deactivate user account
GET /- Root endpoint with API infoGET /health- Health check endpoint
For detailed API documentation, visit http://localhost:8000/docs when the backend is running.
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Make your changes and commit:
git commit -m 'Add amazing feature' - Push to the branch:
git push origin feature/amazing-feature - Open a Pull Request
- Follow PEP 8 for Python code
- Use ESLint and Prettier for JavaScript/React code
- Write tests for new features
- Update documentation as needed
- Ensure all tests pass before submitting PR
- FastAPI: Web framework
- SQLAlchemy: ORM
- Alembic: Database migrations
- Pydantic: Data validation
- bcrypt: Password hashing
- PyJWT: JSON Web Tokens
- Vite: Build tool and dev server
- React: UI library
- React Router: Client-side routing
- Tailwind CSS: Utility-first CSS framework
- Axios: HTTP client
- React Hook Form: Form handling
- React Hot Toast: Notifications
This project is licensed under the MIT License - see the LICENSE file for details.
If you encounter any issues or have questions:
- Check the documentation
- Look through existing issues
- Create a new issue with detailed information
- For urgent matters, contact the development team
- Email verification system
- Password reset functionality
- Two-factor authentication (2FA)
- User roles and permissions
- Social media login integration
- Mobile app version
- Advanced user analytics
- API rate limiting
- Comprehensive test suite
- CI/CD pipeline
β
Backend: Fully implemented and tested
β
Frontend: Fully implemented and tested
β
Authentication: JWT-based security working
β
Database: PostgreSQL integration complete
β
Documentation: Comprehensive docs available
β
Docker: Container support ready
Built with β€οΈ by the development team