A 2001: A Space Odyssey inspired Nx monorepo using Angular and NestJS for querying OpenAI Chat Completions API, keeping track of tokens usage via MongoDB for billing purposes.
EVA library was created for sharing common models among the projects. MOONBASE library provides a generic way of client HTTP requests handling.
Check Understand this workspace section for dependencies graph.
npm install
✨HAL - FE✨
node node_modules/.bin/nx serve hal
✨DISCOVERY - BE✨
node node_modules/.bin/nx serve discovery
✨SPACE ODISSEY - Monorepo✨
node node_modules/.bin/nx run-many --target=serve -p discovery,hal
docker compose up
Commands to run:
mongosh
db.auth("$USER", "$PASSWORD");
- Check mongo-init.js for credentialsshow dbs
use $DB
- Replace $DB for any existing DBshow collections
db.$COLLLECTION.find()
- Replace $COLLECTION for any existing collection
-
Set NODE_ENV to
production
. -
Create
apps/discovery/config/env/production.env
file and setOPENAI_API_KEY
to"your-OPENAI-API-key"
✨ This workspace has been generated by Nx, a Smart, fast and extensible build system. ✨
Run nx graph
to see a diagram of the dependencies of the projects.
Run npx nx connect-to-nx-cloud
to enable remote caching and make CI faster.
Visit the Nx Documentation to learn more.