|
| 1 | +================ |
| 2 | +About the Server |
| 3 | +================ |
| 4 | + |
| 5 | +The server side of Byte is utilizing the `Litestar <https://litestar.dev>`_ framework. |
| 6 | +It is an immensely powerful, fast, and easy to use framework that is perfect for Byte. |
| 7 | + |
| 8 | +The server is responsible for handling all of the requests to and from the database, |
| 9 | +as well as serving the frontend to the user; it utilizes the `Jinja2 <https://jinja.palletsprojects.com/en/3.0.x/>`_ |
| 10 | +templating engine to do so. |
| 11 | + |
| 12 | +There are a few key components to the server, structured like so: |
| 13 | + |
| 14 | +* ``app.py``: The main entry point for the server where the application factory is defined. |
| 15 | +* ``cli.py``: The command line interface for the server. |
| 16 | +* ``__main__.py``: The entry point for the server when running it via the command line. |
| 17 | +* ``lib/``: A directory containing all of the server's logic, settings, and configuration. |
| 18 | +* ``domain/``: A directory containing all of the server's domain logic, including the database models and routes. |
| 19 | + |
| 20 | +The domain is further broken down into logical components, such as: |
| 21 | + |
| 22 | +* ``db/``: The database models |
| 23 | + |
| 24 | + .. note:: These once were houses inside the respective domain components, but were moved to a separate directory to |
| 25 | + make it easier to manage and maintain the database models (but also because circular imports are bad). |
| 26 | +* ``github/``: The GitHub domain logic, including connectivity to GitHub via the |
| 27 | + `githubkit <https://github.com/yanyongyu/githubkit>`_ library. |
| 28 | +* ``guilds/``: The guilds domain logic, including the guilds routes and any helper functions used to perform CRUD |
| 29 | + operations on guilds. |
| 30 | +* ``system/``: The system domain logic, mainly for dealing with tasks and healthchecks for the core system. |
| 31 | +* ``web/``: The web domain logic, including the web routes, frontend resources, and templates |
| 32 | + |
| 33 | +This structure allows for a clear separation of concerns and makes it easy to find and maintain the server's logic. |
0 commit comments