Skip to content

bskimball/astro-fastify-starter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

36f4c15 Β· Feb 11, 2025

History

28 Commits
Jul 10, 2024
Feb 11, 2025
Nov 2, 2024
Jul 10, 2024
Jul 10, 2024
Dec 6, 2024
Feb 11, 2025
Feb 11, 2025
Nov 2, 2024
Feb 11, 2025
Feb 11, 2025
Jul 18, 2024
Nov 28, 2024
Dec 6, 2024
Nov 2, 2024

Repository files navigation

*** Latest ***

This is using Astro v5, Tailwind v4 and React 19.

Astro Fastify Starter

This is an example repo of having astro and fastify in the same app. This example is based on the fastify example in the node adapter section. The main difference is this uses TypeScript. It also has an example of using the trpc fastify adapter, so you have end-to-end type safety.

Blog Post

Auth

Auth was set up for Lucia but has been changed to the guide at Lucia-next. It's currently using username/password auth and storing to a session. That information is available to astro as well as fastify and trpc.

ORM

Data access is done using Drizzle, and the example is set up for an SQLite database.

πŸš€ Project Structure

Inside your Astro project, you'll see the following folders and files:

/
β”œβ”€β”€ public/
β”‚   └── favicon.svg
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ api/
β”‚   β”‚   └── server.ts
β”‚   β”‚   └── dev.ts
β”‚   β”œβ”€β”€ components/
β”‚   β”‚   └── Card.astro
β”‚   β”œβ”€β”€ layouts/
β”‚   β”‚   └── Layout.astro
β”‚   |── pages/
β”‚   |   └── index.astro
|   |-- middleware.ts
|   |-- schema.ts
|   |-- session.ts
└── run-server.mjs
└── package.json

🧞 Commands

All commands are run from the root of the project, from a terminal:

Command Action
npm install Installs dependencies
npm run dev Starts local dev server at localhost:4321
npm run build Build your production site to ./dist/
npm run start Start your production build
npm run astro ... Run CLI commands like astro add, astro check
npm run generate Generate schema
npm run migrate Run migrations
npm run studio Run Drizzle-kit Studio