Sign up and onboarding
Email and password sign up, then a screen to pick a username before anything else.
Clone the repository, start Postgres and Mailpit with Docker, run composer setup in api and pnpm install in web, then run composer dev to start the API, queue worker, log viewer and Next.js.
Try the real flows. Every request the frontend makes shows up in the log.
Sign in
Email and password sign up, then a screen to pick a username before anything else.
Sign in with either one, with “keep me signed in” for longer sessions.
Signed links that don’t need a session, so they open anywhere. They expire after an hour.
The same response whether or not the account exists. A reset signs out every other session.
Email and username checks while you type, including the reserved names you configure.
Profile, email change with re-verification, username, password and account deletion.
Sanctum SPA auth with HTTP-only cookies and CSRF protection. No tokens stored in JavaScript.
Pest and Vitest suites, linting and formatting, run by GitHub Actions on every push.
api/ Laravel API → localhost:8000 web/ Next.js app → localhost:3000 docker/ init scripts for the optional Docker services
MIT licensed. Use it in as many projects as you like, and change whatever you want. Start from the template on GitHub or clone it.
Use this template$ git clone https://github.com/jordansmalls/prism.git my-appDevelopers who want a Laravel API and a Next.js frontend without spending the first week on authentication. Clone it, rename it, and start on your own features.
Prism uses Sanctum’s SPA authentication: an HTTP-only session cookie plus CSRF protection, so there’s no token for JavaScript to leak. The API client fetches /sanctum/csrf-cookie before the first request that changes data, and if it gets a 419 it refreshes the token and retries once.
No. The browser only talks to Next.js, which forwards /api/* and /sanctum/* to Laravel. Cookies belong to the frontend’s domain and there’s no CORS to configure, so you can run Vercel in front of Laravel Cloud.
To call the API directly instead, set NEXT_PUBLIC_API_URL in web, and SESSION_DOMAIN, FRONTEND_URL and SANCTUM_STATEFUL_DOMAINS in api.
No. The included docker-compose.yml starts Postgres 17 and Mailpit, but any PostgreSQL 14+ works. Create the laravel_next and laravel_next_test databases and set your credentials in api/.env.
By default they’re written to api/storage/logs/laravel.log, so you can copy the link straight out. If you run Mailpit, point the MAIL_* settings at it and read them at localhost:8025.
An <AuthGuard> wraps each route group and handles every redirect for guests, onboarding and signed-in users. It only controls what the user sees: the API checks auth on every request, and the onboarded middleware covers routes that need a username.
Set your app name in APP_NAME and NEXT_PUBLIC_APP_NAME, update siteConfig, rename the databases, and add your top-level routes to the reserved usernames. The README has the full checklist.