Astryx Engine is a Next.js 16 app that generates Chinese astrology readings from birth details and postal code input. It uses a local Kerykeion-based chart service plus OpenAI Responses API calls to produce:
- a primary reading summary
- an explanation layer
- a structured analysis layer
- a structured forecast layer
- up to 3 follow-up answers per session
- Next.js 16 + React 19
- OpenAI Node SDK
- Zod
- Vitest + Testing Library
- Optional local FastAPI service in
services/kerykeion_api
- Install dependencies:
npm install- Copy the sample env file:
cp .env.local.sample .env.local-
Fill in the required values in
.env.local. -
Start the app:
npm run dev- Open http://localhost:3000.
Create .env.local from .env.local.sample.
GEONAMES_USERNAMEUsed to resolve postal-code based birth locations.OPENAI_API_KEYUsed for the initial three-pass reading and follow-up answers.LOCAL_ASTROLOGY_API_URLBase URL for the local astrology API.
OPENAI_READING_MODELOverrides the default model. Defaults togpt-5.4.
The app only supports the local FastAPI service in services/kerykeion_api.
- Use Python
3.11.x. - Start the local service:
uv run --project services/kerykeion_api --python 3.11 uvicorn services.kerykeion_api.app:app --host 127.0.0.1 --port 8010- Set
.env.local:
LOCAL_ASTROLOGY_API_URL=http://127.0.0.1:8010
GEONAMES_USERNAME=your_geonames_username
OPENAI_API_KEY=your_openai_api_keyThe app sends natal chart requests to the local API and treats local transit/context endpoints as optional. If the local service does not provide those optional endpoints, the reading flow falls back to the locally available natal chart data.
POST /api/reading
- validates birth date, time, and postal code input
- resolves location from GeoNames
- builds the astrology bundle from the local provider
- normalizes chart payload data
- runs 3 OpenAI structured passes for explanation, analysis, and forecast
- returns the ready reading payload or an unavailable/location-match result
POST /api/reading/follow-up
- verifies the encoded session token
- rebuilds the reading context server-side
- answers a follow-up question in Chinese
- rotates the token and enforces a 3-question limit
npm run dev
npm run build
npm run start
npm run lint
npm run testRun the test suite with:
npm run testThe repo includes frontend, flow, and reading-library tests under test/.