Trade your soul for free copies of free e-books.
Built for the Web Dev Challenge Hackathon #3 (E-comm Edition)
The app is a server-rendered Astro site, and uses the Algolia DocSearch plugin for the Starlight theme.
To add books written in markdown you will need to add the required frontmatter for the docs content collection in Starlight. Run md-titles.py
from /scripts
in the directory of the markdown files you wish to add the frontmatter to. It will add a Title
property based on the file name.
The app uses nanostores to share state between Button.astro
and EbookCard.astro
.
This provides a kind of fake route protection for the demostrative purposes of this hackathon.
But! You could add persistence, middleware, and a payment provider to essentially make an e-commerce site with a built in e-reader.
- Configure Astro SSR
- Deploy your app to your desired provider (this project uses Vercel)
- Use your production link to apply for DocSearch
- Add Algolia to Starlight
Caution
Algolia appId
, apiKey
, and indexName
are safe to use client-side. write
and admin
stay secret.
All commands are run from the root of the project, from a terminal:
Command | Action |
---|---|
pnpm install |
Installs dependencies |
pnpm run dev |
Starts local dev server at localhost:4321 |
pnpm run build |
Build your production site to ./dist/ |
pnpm run preview |
Preview your build locally, before deploying |
pnpm run astro ... |
Run CLI commands like astro add , astro check |
pnpm run astro -- --help |
Get help using the Astro CLI |
Check out Starlight’s docs, read the Astro documentation, or jump into the Astro Discord server.