ohmyapi/docs/apps.md
Brian Wiborg 7163fe778e
♻️ Refactor ohmyapi_auth
- remove Group and UserGroups
  (should be handled by dedicated app, if even)
- enforce User.Schema() include-fields
2025-10-28 14:39:42 +01:00

746 B

Apps

Apps are a way to group database models and API routes that contextually belong together. For example, OhMyAPI comes bundled with an auth app that carries a User model and provides API endpoints for JWT authentication.

Apps help organizing projects by isolating individual components (or "features") from one another.

Create an App

Create a new app by: ohmyapi startapp <name>, i.e.:

ohmyapi startapp restaurant

This will create the following directory structure:

myproject/
  - restaurant/
    - __init__.py
    - models.py
    - routes.py
  - pyproject.toml
  - README.md
  - settings.py

Add restaurant to your INSTALLED_APPS in settings.py and restart you project runtime:

ohmyapi serve