โก Quick Reference
Commands Cheat Sheetโ
๐ Main Commandsโ
# Start development server
yarn start
# Update all API documentation
yarn docs:update
# Clean + update + build production
yarn docs:rebuild
# Build production
yarn build
๐ฅ Swagger Managementโ
# Fetch swagger from all services in .env
yarn swagger:fetch
# Enhance swagger files (add host, basePath, security)
yarn swagger:enhance
# Fetch + enhance (all-in-one)
yarn swagger:update
๐ Documentation Generationโ
# Generate docs for all APIs
yarn gen-all-docs
# Generate docs for specific API
yarn gen-api-docs <api-name>
# Example:
yarn gen-api-docs auth
yarn gen-api-docs rewards
๐งน Cleaningโ
# Clean all API docs
yarn clean-all-docs
# Clean specific API docs
yarn clean-api-docs <api-name>
# Clear Docusaurus cache
yarn clear
# Clear everything (cache + node_modules cache)
rm -rf .docusaurus node_modules/.cache
๐ง Sidebar & Tagsโ
# Fix sidebars + generate tag pages
yarn sidebar:fix
File Structureโ
nomion-docs/
โโโ .env # โ๏ธ Service configurations (GITIGNORED)
โโโ .env.example # ๐ Template for .env
โโโ examples/ # ๐ Swagger JSON files
โ โโโ auth.swagger.json
โ โโโ rewards.swagger.json
โ โโโ statistic.swagger.json
โโโ docs/
โ โโโ api/ # ๐ Auto-generated API docs
โ โ โโโ auth/
โ โ โโโ rewards/
โ โ โโโ statistic/
โ โโโ guides/ # ๐ Manual documentation
โ โโโ add-new-service.md
โ โโโ quick-reference.md
โโโ scripts/ # ๐ ๏ธ TypeScript utilities
โ โโโ swagger-manager.ts # Fetch & enhance swagger
โ โโโ sidebar-manager.ts # Fix sidebars & tag pages
โโโ api-config.ts # ๐ฏ Auto-detect APIs from examples/
Environment Variables Formatโ
# Template for each service
{SERVICE_NAME}_SWAGGER_JSON_URL=https://...
USERNAME_{SERVICE_NAME}=admin
PASSWORD_{SERVICE_NAME}=password
{SERVICE_NAME}_BASE_PATH=/path # Optional
{SERVICE_NAME}_LABEL=Display Name # Optional
Example:โ
AUTH_SWAGGER_JSON_URL=https://backend-dev.nomion.io/auth/swagger/json
USERNAME_AUTH=admin
PASSWORD_AUTH=secret123
AUTH_BASE_PATH=/auth
AUTH_LABEL=Authentication API
Common Workflowsโ
๐ Add New Serviceโ
# 1. Add to .env
echo "NEWSERVICE_SWAGGER_JSON_URL=https://..." >> .env
echo "USERNAME_NEWSERVICE=admin" >> .env
echo "PASSWORD_NEWSERVICE=password" >> .env
# 2. Update docs
yarn docs:update
# 3. Start server
yarn start
๐ Update Existing Serviceโ
# Fetch latest swagger
yarn swagger:fetch
# Regenerate docs
yarn docs:update
๐งน Full Rebuildโ
# Clean everything and rebuild
yarn docs:rebuild
# Or manual steps:
yarn clean-all-docs
yarn clear
yarn docs:update
yarn build
๐ Fix Issuesโ
# Clear cache
yarn clear
# Regenerate specific API
yarn clean-api-docs auth
yarn gen-api-docs auth
# Hard reset
rm -rf .docusaurus node_modules/.cache
yarn start
API Testingโ
๐ Bearer Token Formatโ
Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
Important: Must include "Bearer " prefix with a space!
๐ API Endpointsโ
Format: https://{host}{basePath}{path}
Example:
- Host:
backend-dev.nomion.io - BasePath:
/reward - Path:
/v1/admin/user-rewards - Full URL:
https://backend-dev.nomion.io/reward/v1/admin/user-rewards
Git Workflowโ
๐ Before Commitโ
# Make sure .env is gitignored
echo ".env" >> .gitignore
# Check what will be committed
git status
# Don't commit:
# - .env file
# - .docusaurus/ folder
# - node_modules/
โ Safe to Commitโ
โ
examples/*.swagger.json
โ
docs/api/**/*.mdx
โ
.env.example
โ
scripts/*.ts
โ
package.json
โ
docusaurus.config.ts
Troubleshooting Quick Fixesโ
| Issue | Quick Fix |
|---|---|
| API returns 404 | Check basePath in swagger file |
| No Authorization button | Run yarn swagger:enhance |
| Chunk loading error | Run yarn clear && yarn start |
| Navbar not showing service | Restart dev server |
| Bearer token not working | Add "Bearer " prefix with space |
| CORS error | Backend must enable CORS headers |
Performance Tipsโ
โก Faster Developmentโ
# Only regenerate specific API instead of all
yarn gen-api-docs auth
# Skip sidebar fix if not needed
yarn swagger:update && yarn gen-all-docs
# Use --no-minify for faster builds
yarn build --no-minify
๐พ Reduce Build Sizeโ
- Clean unused API docs
- Remove old swagger files from
examples/ - Clear
.docusaurus/regularly
Keyboard Shortcuts (in docs)โ
| Shortcut | Action |
|---|---|
/ | Focus search |
s | Focus search |
Ctrl+K | Command palette (if enabled) |
Useful URLsโ
Development: http://localhost:3000
API Explorer: http://localhost:3000/docs/api/{service}/
Search: http://localhost:3000/search
Supportโ
- ๐ Full Guide: See
add-new-service.md - ๐ Issues: GitHub Issues
- ๐ฌ Discord: Nomion Community
Last Updated: November 2025
Add New Service (2 Steps)โ
1. Add to .envโ
{SERVICE_NAME}_SWAGGER_JSON_URL=https://your-api.com/swagger.json
USERNAME_{SERVICE_NAME}=admin
PASSWORD_{SERVICE_NAME}=password
2. Run Updateโ
yarn docs:update
Done! โจ
Common Commandsโ
| Command | Description |
|---|---|
yarn docs:update | Main command - Fetch & generate all docs |
yarn swagger:fetch | Fetch Swagger files from URLs in .env |
yarn gen-all-docs | Generate docs from existing Swagger files |
yarn start | Start dev server |
yarn build | Build for production |
yarn clear | Clear cache |
Environment Variables Formatโ
# Required
{SERVICE_NAME}_SWAGGER_JSON_URL=https://...
# Optional (if endpoint requires auth)
USERNAME_{SERVICE_NAME}=admin
PASSWORD_{SERVICE_NAME}=secret
Examples:
AUTH_SWAGGER_JSON_URL=https://auth.api.com/swagger.json
PAYMENT_SWAGGER_JSON_URL=https://payment.api.com/swagger.json
NOTIFICATION_SWAGGER_JSON_URL=https://notify.api.com/swagger.json
Auto-Generated Structureโ
{SERVICE_NAME} โ service-name
โ
examples/service-name.swagger.json
โ
docs/api/service-name/
โ
/docs/api/service-name/service-name-api
Custom Service Labelโ
Edit api-config.ts:
const specialCases: Record<string, string> = {
'auth': 'Auth',
'payment': 'Payment', // Add here
};
Troubleshootingโ
Service not showing?โ
yarn clear
yarn docs:update
yarn start
Fetch failed?โ
- โ Check URL is accessible
- โ Verify username/password if required
- โ
Check
.envfile syntax - โ Ensure HTTPS endpoint allows self-signed certs
Build errors?โ
yarn clean-all-docs
yarn clear
yarn docs:update
Full Update Pipelineโ
yarn docs:update runs:
fetch-swagger- Fetch from URLsenhance-swagger- Add metadatafix-swagger- Fix security schemesfix-swagger-operations- Normalize IDsgen-api-docs all- Generate docsgenerate-tag-pages- Create tag pagesfix-sidebars- Fix navigation
New Feature: Curl Debug Tabโ
After sending any API request, a Curl tab appears showing the exact curl command for debugging! ๐
curl --location 'https://api.example.com/v1/users' \
--header 'Authorization: Bearer xxx' \
--header 'Content-Type: application/json' \
--data '{"name":"John"}'
Perfect for:
- ๐ Copy-paste to terminal
- ๐ Debug requests
- ๐ Share with team
- ๐ง Test in Postman/Insomnia