How mindaandreea/iot_device_app_template works
This is a FastAPI foundation for IoT and AI-powered applications. The shown user workflow is registration or login, followed by authenticated device creation and credential provisioning; devices can later authenticate using those credentials. Shared configuration and SQLAlchemy sessions support the API and its models. The tree also contains AI, telemetry, and notification modules, but their files are only minimal stubs in the available index, so their runtime capabilities and connections cannot be established here.
Main entry points: database.py Database sessions · devices/router.py Device endpoints · auth/router.py Auth endpoints · device_dependencies.py Device authentication
Components 16
API workflows
- FastAPI app
backend/app/main.py - Auth endpoints
backend/app/auth/router.py - Device endpoints
backend/app/devices/router.py
Identity and access
- User authentication
backend/app/auth/dependencies.py - Password and tokens
backend/app/auth/security.py - User model
backend/app/auth/models.py - Auth schemas
backend/app/auth/schemas.py
Device lifecycle
- Device models
backend/app/devices/models.py - Device schemas
backend/app/devices/schemas.py - Device authentication
backend/app/devices/device_dependencies.py - Credential provisioning
backend/app/devices/provisioning.py - Device key security
backend/app/devices/security.py
Runtime foundation
- Settings
backend/app/core/config.py - Database sessions
backend/app/core/database.py - SQL database
Other components
- API client
Connections 26
- API client → FastAPI app: sends requests
backend/app/main.py - FastAPI app → Auth endpoints: registers routes
backend/app/main.py - FastAPI app → Device endpoints: registers routes
backend/app/main.py - Auth endpoints → Password and tokens: hashes and issues
backend/app/auth/router.py - Auth endpoints → User model: queries and stores
backend/app/auth/router.py - Auth endpoints → Auth schemas: validates and returns
backend/app/auth/router.py - Auth endpoints → Database sessions: gets session
backend/app/auth/router.py - User authentication → Password and tokens: decodes token
backend/app/auth/dependencies.py - User authentication → User model: loads user
backend/app/auth/dependencies.py - User authentication → Database sessions: gets session
backend/app/auth/dependencies.py - Device endpoints → User authentication: requires user
backend/app/devices/router.py - Device endpoints → Device models: queries and stores
backend/app/devices/router.py - Device endpoints → Device schemas: validates and returns
backend/app/devices/router.py - Device endpoints → Database sessions: gets session
backend/app/devices/router.py - Device endpoints → Credential provisioning: creates or deactivates
backend/app/devices/router.py - Device endpoints → Device authentication: authenticates device
backend/app/devices/router.py - Device authentication → Device models: loads device credentials
backend/app/devices/device_dependencies.py - Device authentication → Device key security: verifies key
backend/app/devices/device_dependencies.py - Device authentication → Database sessions: gets session
backend/app/devices/device_dependencies.py - Credential provisioning → Device models: creates credential
backend/app/devices/provisioning.py - Credential provisioning → Device key security: generates and hashes
backend/app/devices/provisioning.py - Password and tokens → Settings: reads token settings
backend/app/auth/security.py - User model → Database sessions: uses ORM base
backend/app/auth/models.py - Device models → Database sessions: uses ORM base
backend/app/devices/models.py - Database sessions → Settings: reads database URL
backend/app/core/database.py - Database sessions → SQL database: opens connections