chore: scaffold moments workspace
Cargo workspace with five crates per architecture conventions:
- moments-entities: Source enum, Event, EventQuery, SourceSummary
- moments-core: EventReader / EventWriter ports
- moments-data: PgStore (sqlx postgres adapter) + 0001_init.sql
- moments-api: axum binary; /v1/{healthz,events,sources}
- moments-worker: skeleton; pollers land in step 2
Sources committed-to for ingestion: github, gitea, hg, bugzilla.
Workstation events explicitly retired (not deferred).
Build + clippy clean. sqlx queries use the runtime API for now;
will switch to compile-time-checked macros + .sqlx offline cache
once magrathea has the moments_{ro,rw} roles and database created.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
41
readme.md
Normal file
41
readme.md
Normal file
@@ -0,0 +1,41 @@
|
||||
# moments
|
||||
|
||||
Personal activity timeline for [rob.tn](https://rob.tn). Polls public sources (GitHub, Gitea, hg-edge.mozilla.org, bugzilla.mozilla.org), stores raw payloads in Postgres, and serves a reshaped timeline to a static React frontend.
|
||||
|
||||
Successor to the now-defunct [grenade-events-react](https://github.com/grenade/grenade-events-react), which depended on MongoDB Stitch (retired by MongoDB in September 2022).
|
||||
|
||||
## Layout
|
||||
|
||||
```
|
||||
crates/
|
||||
moments-entities/ # types and DTOs
|
||||
moments-core/ # ingestion + reshape logic
|
||||
moments-data/ # postgres adapter + migrations
|
||||
moments-api/ # axum read-only HTTP API (binary)
|
||||
moments-worker/ # ingestion daemon (binary)
|
||||
ui/ # vite + react + swc + ts frontend
|
||||
asset/ # systemd, nginx, firewalld, manifest.yml
|
||||
script/deploy.sh
|
||||
```
|
||||
|
||||
Architectural conventions follow [grenade/architecture/generic.md](https://git.lair.cafe/grenade/architecture/src/branch/main/generic.md).
|
||||
|
||||
## Local development
|
||||
|
||||
```sh
|
||||
cargo build --workspace
|
||||
cargo run -p moments-api # serves on 127.0.0.1:8080
|
||||
cargo run -p moments-worker # one-shot ingest tick (until --interval is wired up)
|
||||
```
|
||||
|
||||
The API expects a Postgres reachable at `DATABASE_URL`. For magrathea, that's an mTLS connection using the host cert. For local dev against a throwaway database:
|
||||
|
||||
```sh
|
||||
DATABASE_URL=postgres://localhost/moments cargo run -p moments-api
|
||||
```
|
||||
|
||||
Migrations live in `crates/moments-data/migrations/` and run automatically on API startup.
|
||||
|
||||
## Deployment
|
||||
|
||||
See `asset/manifest.yml` and `script/deploy.sh`.
|
||||
Reference in New Issue
Block a user