Skip to content

dossierhq/dossier-astro-sqlite-app

Repository files navigation

dossier-astro-sqlite-app

Node CI

This is a template for an app using Dossier, Astro and SQLite.

Getting started

  • npm init using dossierhq/dossier-astro-sqlite-app my-project
  • cd my-project
  • git init && git add . && git commit -m '🚀 Created project 🚀'
  • pnpm install
  • pnpm run build
  • pnpm start

You should now have a working app running at http://localhost:4321. To access the Dossier web interface open http://localhost:4321/dossier/content in your browser. Try to add an entity type to the schema and create some entities.

The home page fetches some published entities and displays their names in a list.

The database is a SQLite database, stored in database/dossier.sqlite.

A Typescript file is generated in src/generated/SchemaTypes.ts based on the Dossier schema whenever you run pnpm run build (or if you explicitly run pnpm run schema-types:generate).

Auth

There is no authentication in this example. However, there are two different users used:

  • In development mode (pnpm start), the editor principal is used (specified in DOSSIER_PRINCIPAL_ID in .env.development)
  • In production mode (pnpm build && pnpm start:production), the reader principal is used (specified in DOSSIER_PRINCIPAL_ID in .env). The reader principal can't access the Dossier API.

The Dossier web interface is disabled in production mode.

N.B. Supporting multiple users and real authentication is left as an exercise.