A full-featured tech blog platform built with Flask (backend), React.js (frontend), and PostgreSQL. Features include user authentication, post creation/editing, voting, comments, and more.
Page for viewing and searching all blog posts
Page for viewing a single blog post with comments
User profile page with post history
- User registration, login, and JWT authentication
- Create, edit, and delete blog posts
- Upvote/downvote posts
- Comment on posts (with delete support)
- Search and filter posts by tags
- Tag support (with automatic formatting)
- User profile and post history
- Responsive, modern UI with modals and loading overlays
- Secure API endpoints
-
Navigate to the
backenddirectory:cd backend -
Install dependencies:
pip install -r requirements.txt
-
⚙️ Set up the database connection in
config.py, and configure any environment variables you might need. -
📦 Make initial database migrations:
flask db init flask db migrate -m "initial migration" flask db upgrade
-
Navigate to the
frontenddirectory:cd frontend -
Install dependencies:
npm install
-
🚀 Start the React application:
npm start
-
Build and start all services:
docker compose up --build -d
-
Check logs for all services:
docker compose logs -f
-
Stop all services:
docker compose down
-
(Optional) Rebuild without cache:
docker compose build --no-cache
- Make sure you have your environment variables set in
backend/.envandfrontend/.envbefore building, use the.env.examplefiles as templates. - The frontend should be built locally (
npm run build) and the output copied tobackend/frontend/buildif you are not building the frontend inside Docker. - Run
build_and_copy_frontend.shto automate this process.
-
Backend:
- Flask
- Flask-SQLAlchemy
- Flask-Migrate
- Flask-JWT-Extended
- Flask-Cors
- psycopg2-binary (psql database adapter)
- resend (for email sending)
- python-dotenv
- pytest (for testing)
- ruff (for linting)
- black (for code formatting)
-
Frontend:
- React
- React Router
- Axios
- Redux Toolkit
- Redux Persist
- React Redux
- Tailwind CSS
- react-markdown (for rendering markdown)
- react-quill (for rich text editing)
- dotenv (for environment variables)
-
Backend:
-
Run tests using pytest:
pytest
-
-
Frontend:
-
Run tests using Jest:
npm test
-
# Flask environment variables
SECRET_KEY=your_secret_key
JWT_SECRET_KEY=your_jwt_secret_key
# Database configuration
POSTGRES_USER=postgres_user
POSTGRES_PASSWORD=postgres_password
POSTGRES_DB=postgres_db
DATABASE_URL=postgres://your_username:your_password@db:5432/your_db_name
# SMTP configuration
RESEND_API_KEY=your_resend_api_key
# React environment variables
REACT_APP_BACKEND_URL=http://localhost:5000
REACT_APP_RECAPTCHA_SITE_KEY=your_recaptcha_site_key
# reCAPTCHA configuration
RECAPTCHA_SECRET_KEY=your_recaptcha_secret_keyThis project is licensed under the MIT License.