Quick Start — Aquilia Documentation
Comprehensive guide and documentation for Quick Start in the Aquilia framework. View API reference, examples, and implementation patterns.
Quick Start Build a working API in 5 minutes This guide walks you through creating, configuring, and running an Aquilia application from scratch. By the end, you'll have a multi-endpoint REST API with dependency injection, validation contracts, database models, and unit tests. 1 Create a Workspace Use the aq init workspace command to scaffold a new workspace directory containing standard project configuration files: This command generates the following project layout: Workspace Configuration Open workspace.py to see the Fluent Builder configuration structure. The workspace config manages environment settings, module registrations, and third-party integrations: Starter welcome page The workspace starts with a welcome controller defined in starter.py: 2 Add a Module To add a new feature or logical domain to your workspace, run aq add module [NAME]: This scaffolds a new module directory structure under modules/tasks/: Here is the complete, valid, executable example code for each of these files as scaffolded by the CLI generator: modules/tasks/manifest.py modules/tasks/__init__.py modules/tasks/contracts.py modules/tasks/controllers.py ") async def get_task(self, ctx: RequestCtx, id: int): """Get a task by ID.""" item = await self.service.get_by_id(id) if not item: raise TasksNotFoundFault(item_id=id) return Response.json(item) @PUT("/ ") async def update_task(self, ctx: RequestCtx, id: int, data: TaskContract): """Update a task by ID.""" item = await self.service.update(id, data.to_dict()) if not item: raise TasksNotFoundFault(item_id=id) return Response.json(item) @DELETE("/ ") async def delete_task(self, ctx: RequestCtx, id: int): """Delete a task.""" deleted = await self.service.delete(id) if not deleted: raise TasksNotFoundFault(item_id=id) return Response(status=204)`} language="python" /> modules/tasks/services.py List[dict]: return self._storage async def get_by_id(self, item_id: int) -> Optional[dict]: for item in self._storage: if item["id"] == item_id: return item return None async def create(self, data: dict) -> dict: item = self._storage.append(item) self._next_id += 1 return item async def update(self, item_id: int, data: dict) -> Optional[dict]: item = await self.get_by_id(item_id) if item: item.update(data) return item async def delete(self, item_id: int) -> bool: for i, item in enumerate(self._storage): if item["id"] == item_id: self._storage.pop(i) return True return False`} language="python" /> modules/tasks/faults.py modules/tasks/models.py "`} language="python" /> The CLI auto-discovery updates workspace.py to register your new module as a pointer, ensuring your routes and metadata are wireable: 3 Run the Development Server Upon booting, the compiler outputs the route registrations and subsystem configurations: PUT /tasks/ DELETE /tasks/ Serving on http://127.0.0.1:8000 (Press Ctrl+C to stop)`} language="text" /> Open http://127.0.0.1:8000 in your browser to inspect the dev console. 4 Test with cURL 5 Write Tests Use the built-in AquiliaTestCase to run integration and endpoint verification tests against the modules. You do not need to construct a test client manually; use the built-in self.client property along with status assertion methods: Run the tests using the CLI wrapper: Next Steps , , , , , , ].map((link, i) => ( ))} )
Go to Homepage