PyNextStack: a full-stack user management starter
FastAPI backend, Next.js frontend, auth and profiles out of the box
Overview
PyNextStack is a starter kit for full-stack applications that need user accounts. It pairs a FastAPI backend with a Next.js frontend, handles registration, authentication, password reset, profile management, and email verification out of the box. The goal is to get to your first real feature on day one.
The problem it solves
Every new product I start spends the first week rebuilding the same user-management layer. Registration, login, session, password reset, email verification, profile pages, admin. It is all commodity work, none of it is product-differentiating, and most of it has subtle security pitfalls. PyNextStack captures the pieces I'd write anyway so I can skip straight to the part that actually matters.
What is included
- FastAPI backend with JWT auth, password hashing (bcrypt), email verification, and password reset flows
- Next.js frontend with typed API client, protected routes, and Material-UI components
- Database layer abstracted so you can swap PostgreSQL, MySQL, or MongoDB
- Email layer pluggable for SendGrid, AWS SES, SMTP, or local testing
- Admin area with user list, role management, and audit log
- Docker Compose for local development with hot reload on both ends
Design choices worth highlighting
The frontend and backend communicate through a typed API client generated from the FastAPI OpenAPI schema. That means when you change a backend endpoint, the TypeScript types update automatically and the frontend breaks with a compiler error. No runtime drift between the two.
Auth uses short-lived access tokens (15 minutes) paired with long-lived refresh tokens (7 days, httpOnly cookie). The access token lives in memory, the refresh token is invisible to JavaScript. This is the sweet spot between developer ergonomics and security.
Tech stack
Python, FastAPI, Pydantic, SQLAlchemy or Motor (depending on DB), Next.js App Router, React, TypeScript, Material-UI, Docker, and GitHub Actions for CI.
Takeaway
Starter kits earn their keep when they embody opinions. PyNextStack is opinionated on purpose: short-lived JWTs, refresh tokens in httpOnly cookies, typed API client, Material-UI as the component library. If your product has different needs, fork it. If it doesn't, use it and ship.
