This starter repo sets up:
- Frontend: Next.js with Tailwind CSS, integrated with Prismic CMS.
- Backend: FastAPI server with basic user management (user & admin).
- Deployment: Vercel for frontend and any compatible host for backend.
Before running this project, you’ll need the following accounts:
-
GitHub
- Sign up at https://github.com/.
- Create a new repository named
prismic-nextjs-fastapi-dashboard. - Clone it locally:
git clone [email protected]:your-username/prismic-nextjs-fastapi-dashboard.git
-
Prismic CMS
- Sign up at https://prismic.io/.
- From the dashboard, select New repository.
- Give it the name
prismic-nextjs-fastapi-dashboardand choose any starter kit. - Go to Settings > API & Security and note:
- API endpoint:
https://prismic-nextjs-fastapi-dashboard.prismic.io/api/v2 - Access Token (create a permanent token).
- API endpoint:
-
Frontend Hosting
- Vercel
- Sign up at https://vercel.com/ (or use your GitHub login).
- Import the GitHub repository.
- Under Project Settings > Environment Variables, add:
PRISMIC_REPO_NAME= prismic-nextjs-fastapi-dashboardPRISMIC_ACCESS_TOKEN= the token from PrismicNEXT_PUBLIC_API_URL=https://<your-vercel-domain>/api
- DigitalOcean App Platform
- Sign up at https://www.digitalocean.com/.
- Create a New App.
- Connect your GitHub repo and select the
frontenddirectory. - In Build & Deploy settings:
- Build Command:
npm install && npm run build - Output Directory:
.next - Run Command:
npm start
- Build Command:
- Under Environment Variables, add:
PRISMIC_REPO_NAME= prismic-nextjs-fastapi-dashboardPRISMIC_ACCESS_TOKEN= the token from PrismicNEXT_PUBLIC_API_URL=https://<your-app>.ondigitalocean.app/api
- Choose your region and click Create App.
- Vercel
-
Backend Hosting
- Sign up for your chosen FastAPI-friendly platform (Railway, Heroku, or DigitalOcean App Platform).
- Create a new project/app and connect the
backendfolder from your repo. - Configure Environment Variables:
DATABASE_URL= your database connection string (e.g.postgres://...or SQLite file URL)SECRET_KEY= a long random string (for JWT signing)ALGORITHM=HS256ACCESS_TOKEN_EXPIRE_MINUTES=30
- For DigitalOcean App Platform backend component:
- Run Command:
uvicorn main:app --host 0.0.0.0 --port 8000 --reload - Choose a region and Create App.
- Run Command:
-
Optional: Custom Domain
- On Vercel, add a custom domain under Domains and follow DNS instructions.
- Navigate to
backend/ - Copy
.env.exampleto.envand fill in values. - Install dependencies:
The requirements now include
pip install -r requirements.txt
psycopg2-binaryso Postgres databases work out of the box. - Run:
uvicorn main:app --reload
- Navigate to
frontend/ - If you haven't already initialized Prismic, run:
npx @slicemachine/init@latest --repository prismic-nextjs-fastapi-dashboard --starter nextjs-starter-prismic-minimal
- Copy
.env.exampleto.envand fill in your Prismic credentials. - Install dependencies:
npm install
- Run:
npm run dev
- To build for production, run:
This automatically installs dependencies if they aren't already installed.
npm run build
Global header and footer content is managed through a Prismic custom type named
settings. The schema lives at
frontend/prismic-nextjs-fastapi-dashboard/customtypes/settings/index.json.
After creating or modifying this type in Slice Machine, push it to Prismic so
the fields are available in the CMS. The Next.js layout fetches this document
and passes the data to the Header and Footer components.
├── backend/ │ ├── app/ │ ├── main.py │ ├── requirements.txt │ └── .env.example ├── frontend/ │ ├── app/ │ ├── lib/ │ ├── styles/ │ ├── package.json │ └── .env.example ├── .gitignore └── README.md
- Frontend on Vercel (auto from
frontend/). - Backend on any FastAPI-friendly host.
Run the API and frontend together during development:
uvicorn backend.main:app --reload &
npm --prefix frontend run dev