LifeOS Template is an Astro + Cloudflare (Pages/Workers + D1) project that combines four modules in one app:
- Execution: tasks and project management
- Knowledge: notes and synthesis
- Lifestyle: budget, expenses, and relationship records
- Vitals: reflection, principles, and AI-assisted chat
It includes an API layer built with Hono under src/pages/api/[...path].ts and uses a D1 database binding named DB.
- Astro (server output)
- Cloudflare adapter for Astro
- Hono for API routing
- Cloudflare D1 for storage
- Tailwind CSS
Before running locally, make sure you have:
- Node.js 18+ (Node 20+ recommended)
- npm
- A Cloudflare account
- Wrangler (installed via project dependencies)
git clone https://github.com/Epiphany-Leon/LifeOS-template.git
cd LifeOS-template
npm installThis project includes .env.example.
cp .env.example .envUpdate .env with real values:
DEEPSEEK_API_KEY(you can change any other AI platform API)CLOUDFLARE_API_TOKEN(optional helper token)
Edit wrangler.json and replace placeholder values:
database_id: set your real D1 database ID- Keep
bindingasDB(required by API code)
If you have not created the database yet:
npx wrangler d1 create lifeos-dbThen copy the generated database_id into wrangler.json.
Apply SQL files to your local D1 instance:
npx wrangler d1 execute lifeos-db --local --file=db/schema.sql
npx wrangler d1 execute lifeos-db --local --file=db/update.sqlNote: The template includes API endpoints for additional runtime data structures (for example,
connectionscan also be reset via/api/init-connections). If you extend the API tables, keep your SQL schema in sync.
npm run devDefault local URL:
http://localhost:4321
npm run build
npm run previewBuild first:
npm run buildThen deploy the dist folder:
npx wrangler pages deploy distMake sure your production environment has:
- D1 binding
DB - Secret
DEEPSEEK_API_KEY
| Command | Description |
|---|---|
npm run dev |
Start development server |
npm run build |
Build app to dist/ |
npm run preview |
Preview built app |
npm run astro |
Run Astro CLI |
npm run clean:env_reset |
Kill local node/workerd processes and reset .wrangler cache |
.
├── db/
│ ├── schema.sql
│ └── update.sql
├── public/
├── src/
│ ├── components/
│ ├── layouts/
│ ├── pages/
│ │ ├── api/[...path].ts
│ │ ├── execution/
│ │ ├── knowledge/
│ │ ├── lifestyle/
│ │ ├── vitals/
│ │ └── index.astro
│ └── styles/
├── astro.config.mjs
├── wrangler.json
└── package.json
- Do not commit real secrets (
.env,.dev.vars, API keys, tokens). - Keep
.env.exampleas placeholders only. - Do not commit build output (
dist/) to source control.
See LICENSE for details.