A type-safe starter project following the latest best practices
- ✅ The latest Next.js (v15 rc)
- ✅ Bun package manager and test runner
- ✅ Complete type-aware linting with Eslint 9
- ✅ Beautiful code-style from Prettier
- ✅ Automatic CI with Github Actions
- ✅ Type-safe environment variables via t3-env
- ✅ Tailwind CSS for utility-first CSS
- ✅ Automatic sitemap.xml, robots.txt, and manifest generation
- ✅ Database support via Drizzle ORM and Cloudflare D1
- ✅ Authentication (OAuth2) via Lucia
git clone git@github.com:startkit-dev/next.git <your-project-name>
Once cloned, you can run the setup script to get everything initialized:
bun run setup
bun dev
Open http://localhost:3000 with your browser to see the result.
You can start editing the page by modifying app/page.tsx
. The page auto-updates as you edit the file.
The project comes with some useful scripts.
bun check - Perform a full check of the repo (lint, format, test, and type-check)
bun fix - Fix any lint and formatting issues
bun lint - Lint the repository
bun format:check - Check the formatting of the repository
bun format - Fix any formatting issues
bun run outdated - Find any outdated packages
There are several environment variables that are required for using the app.
Server-only environment variables (./env/server.ts
)
You must create a db
bun wrangler d1 create startkit-next-d1
bun wrangler d1 create startkit-next-d1-preview --env preview
Locally:
bun db:migrate --local
Remotely:
This happens automatically during deploy via the bin/release
script. The migration occurs as the final step of the build process before the new code is deployed to the Cloudflare Edge network.
Because of this zero-downtime deployment, there is a small timeframe where the database is migrated and the previous code is still live (before the new code is live). Please be sure to write your migrations accordingly.
You can enable background jobs within the same app via Cloudflare Queues by adding a custom entryponit and defining the queue handler.
For example:
import nextOnPagesHandler from "@cloudflare/next-on-pages/fetch-handler"
export default {
fetch: nextOnPagesHandler.fetch,
async queue(batch: MessageBatch<TYPE>, env: Environment) {
// process logic
}
} as ExportedHandler<{ ASSETS: Fetcher }>