JustPost is a social app with a FastAPI backend and a Streamlit frontend. Users can sign up, log in, upload image/video posts, like posts, comment, follow/unfollow other users, and manage profile details (custom username + birthday).
- JWT auth with
fastapi-users - Image and video uploads via ImageKit
- Feed with likes and comments
- Follow / unfollow users
- Profile stats (followers, following, posts)
- Profile editing (
custom_username,birthday) - Shareable media links from the frontend
- Backend:
FastAPI,SQLAlchemy (async),fastapi-users,asyncpg - Frontend:
Streamlit - Media hosting:
ImageKit - Database:
PostgreSQL
app/
main.py # API routes and business logic
db.py # DB models + async connection/session setup
users.py # FastAPI Users auth configuration
schemas.py # User/Post schemas
frontend.py # Streamlit client app
- Python
3.12+ - PostgreSQL
- ImageKit account (private key required)
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txtCreate a .env file in the project root:
# Option 1: full database URL
DATABASE_URL=postgresql+asyncpg://USER:PASSWORD@HOST:5432/DB_NAME
# Option 2: separate PG vars (used when DATABASE_URL is not set)
PGHOST=localhost
PGPORT=5432
PGDATABASE=justpost
PGUSER=postgres
PGPASSWORD=postgres
PGSSLMODE=prefer
# Required for upload API
IMAGEKIT_PRIVATE_KEY=your_imagekit_private_key
# Optional (frontend default)
BASE_URL=http://localhost:8000For Render deployment, set frontend BASE_URL to your backend public URL (for example, https://your-backend-service.onrender.com).
Start backend:
uvicorn app.main:app --reload --host 0.0.0.0 --port 8000Start frontend (new terminal):
streamlit run frontend.pyOpen:
- API docs:
http://localhost:8000/docs - Frontend:
http://localhost:8501
Render free web services sleep after inactivity and wake independently.
This app sends a one-time, non-blocking backend /health ping on frontend startup so opening the frontend URL can wake the backend without delaying frontend render.
- Auth
POST /auth/registerPOST /auth/jwt/loginGET /auth/me
- Posts
POST /uploadGET /feedDELETE /posts/{post_id}
- Likes
POST /posts/{post_id}/likeDELETE /posts/{post_id}/like
- Comments
POST /posts/{post_id}/commentsGET /posts/{post_id}/commentsDELETE /comments/{comment_id}
- Follow & Profile
POST /users/{user_id}/followDELETE /users/{user_id}/followGET /users/{user_id}/profileGET /users/{user_id}/followersGET /users/{user_id}/followingGET /users/profile/mePUT /users/profile/me
Watch the full project demo here:
https://youtu.be/v0czx0QKHss
-1.jpeg)