Skip to content

bastien-pruvost/codifeed

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Codifeed

A modern, open-source, social network


πŸ“– About the Project

Codifeed is a modern and open-source social network. Built as the capstone project for Harvard's CS50x course, it demonstrates how to create a type-safe full-stack application using React (TypeScript) and Flask (Python).

This project showcases complete type safety between a Python backend and TypeScript frontend through OpenAPI specifications, advanced security patterns, and professional-grade architecture suitable for scaling.

Project Goals

  • CS50x Validation: Demonstrate mastery of full-stack development concepts
  • Type Safety: Achieve 100% type safety between Python backend and TypeScript frontend
  • Best Practices: Showcase modern web development patterns and security practices
  • Open Source: Provide a reference implementation for the community

✨ Features

Authentication & Security

  • JWT Authentication - Secure registration and login system
  • Password Security - Argon2 password hashing and validation
  • Session Management - Automatic token refresh and secure logout

User Profiles

  • Personal Profiles - View your own and other user' profiles
  • User Identity - Clean, professional profile layout for the user community

Posts & Content Creation

  • Text Posts - Create and edit posts with text content
  • Post Management - Delete your own posts

Social Interactions

  • Engagement System - Like posts
  • Follow Network - Follow/unfollow other users to build your network

Feed & Discovery

  • Feed System - See posts from users you follow
  • Search Functionality - Find users by name or username

User Experience

  • Mobile-First Design - Responsive layout optimized for all devices
  • Performance Optimized - Fast loading with modern React patterns
  • Accessibility - WCAG compliant design for inclusive user experience

πŸ—οΈ Infrastructure

Enterprise-Grade Security

  • JWT Authentication - Secure cookie-based authentication with auto-refresh
  • CSRF Protection - Complete CSRF protection with double-submit cookie pattern
  • Input Validation - Comprehensive input validation using Pydantic models and Zod schemas
  • SQL Injection Protection - SQLModel ORM with safe queries

Complete Type Safety

  • OpenAPI Integration - Automatic API documentation and client generation with Flask-OpenAPI3 and openapi-typescript
  • Generated Types - TypeScript types auto-generated from OpenAPI specification
  • Runtime Validation - Request/response validation at runtime using Zod schemas
  • End-to-End Type Safety - From database to UI components

Developer Experience

  • Hot Reload - Instant development feedback with Vite and Flask dev server
  • Code Quality - Automated linting, formatting, and type checking with Ruff, Pyright, ESLint and Prettier
  • Database Migrations - Alembic migrations with version control
  • API Documentation - Interactive Swagger UI for API exploration

πŸ› οΈ Tech Stack

Frontend

Backend

Database & Storage

Hosting & Deployment

  • Vercel - Frontend hosting with global CDN
  • Railway - Backend API hosting with automatic deployments
  • Neon - Serverless PostgreSQL hosting

Development Tools

  • Poetry - Python dependency management
  • Ruff - Lightning-fast Python linter and formatter
  • Pyright - Static type checker for Python
  • ESLint - TypeScript/React linting
  • Prettier - Code formatting

πŸ”— Type Safety

One of the key features of Codifeed is complete type safety between the backend and frontend.

How it works

  1. Backend Models - SQLModel defines database models with full type hints
  2. Pydantic Validation - Automatic request/response validation
  3. OpenAPI Generation - Flask-OpenAPI3 generates OpenAPI specification
  4. Type Generation - openapi-typescript creates TypeScript types from OpenAPI
  5. Type-Safe Client - openapi-fetch provides fully typed API calls
  6. Runtime Safety - Zod schemas validate data at component boundaries

This ensures that any changes to the backend API are immediately reflected in the frontend types, catching errors at compile time rather than runtime.


πŸš€ Quick Start

Prerequisites

  • Node.js 22+ and pnpm 10+
  • Python 3.13+ and Poetry
  • PostgreSQL (or use Neon for cloud database)

1. Clone the repository

git clone https://github.com/bastien-limbour/codifeed.git cd codifeed

2. Environment Setup

Copy example environment files and fill required values.

cp api/.env.example api/.env.local cp web/.env.example web/.env.local

3. Backend Setup

cd api poetry install poetry run python dev.py

4. Frontend Setup

Note: Ensure the API from the previous step is running before generating types.

cd web pnpm install pnpm run openapi-ts # Generate types from API pnpm run dev

5. Database Setup (optional)

Option A: Start a local PostgreSQL instance

docker compose -f database/docker-compose.yml up -d

Option B: Apply Alembic migrations

cd api poetry run alembic upgrade head

Note: For local development, tables are also created automatically at app startup via SQLModel. Migrations are recommended for team/production environments.

The application will be available at:


🌐 Deployment

Production Environment

The application is designed for cloud-native deployment:

  • Frontend β†’ Vercel (Automatic deployments from main branch)
  • Backend β†’ Railway (Docker-based deployment)
  • Database β†’ Neon PostgreSQL (Serverless, auto-scaling)

🀝 Contributing

We welcome contributions! This project serves as a learning resource for developers interested in modern full-stack development.

Development Workflow

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-feature
  3. Make your changes with full type safety
  4. Run tests: pnpm test (frontend) and poetry run pytest (backend)
  5. Submit a pull request

Code Standards

  • Type Safety: All code must be fully typed
  • Testing: New features require tests
  • Documentation: Update docs for API changes
  • Security: Follow OWASP security guidelines

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.


πŸ™ Acknowledgments

  • Harvard CS50x for providing excellent computer science education
  • Open Source Community for the amazing tools and libraries
  • Developer Community for inspiration and feedback

About

A social network, built as a full-stack project featuring a Flask API and a TypeScript React frontend.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published