Generator - The Pattern
Rocket Generator is a tool built using a 2nd generation pattern on top of AppSeed.
Here are the main improvements that makes the generator superior in most aspects:
- Slim-fit Codebase
- UI installed from libraries (not hardcoded in the codebase)
- API Generator usable for any defined Model
- Extended User Model
- Models Editor
- Deployment-Ready via DeployPRO
Let's say a few words about each one.
Slim-Fit Codebase
The AppSeed Generator provides all the features inside the starter and this makes the codebase FAT
, sometimes with 500 files or more (up to 1k).
From the user perspective, this might not be a problem but during the GitHub upload, the process sometimes gets canceled due to the overuse of GitHub API.
Rocket Generator uses a different pattern where all the features are libraries: UI Kits, and API Generator. The process simply executed the following steps:
- Collects the user input
- Injects the configuration for the UI
- Generates the models using the definitions
- Activate the API for selected models
With this new pattern, the most complex starter shouldn't have more than 100 files because the actual build happens on the user side during compilation.
UI (External Libraries)
All the UI kist integrated with the generator can be used by anyone outside the service. Here are the links:
- Django Admin Soft -
dashboard design
- Tabler -
dashboard design
- Berry Bootstrap 5 -
dashboard design
- Corporate UI -
dashboard design
- Material KIT -
UI Kit Design
- Pixel Bootstrap 5 -
UI Kit Design
When the user selects one kit/dashboard from the above list, the generator executes the same steps on the sample codebase as the ones listed on the README.
For instance, if the user selects Soft Dashboard, here are the steps executed by the generator:
- Add
django-admin-soft-dashboard
as a dependency inrequirements.txt
- Update
configuration->INSTALLED_APPS
section:- Add
admin_soft.apps.AdminSoftDashboardConfig
- Add
- Update project routing
- Add
path('', include('admin_soft.urls')),
- Add
The above steps are executed by a custom parser that knows how to safely update the codebase, apply changes and keep the project compilable once the changes are operated.
API Generator
For each defined model, the user has the option to activate an API node with full CRUD access:
- GET requests are public (get All items, get item by ID)
- Mutating Requests (CREATE, UPDATE, DELETE) requires authentication
This feature is provided via Django API Generator, an open-source library built on top of DRF
.
Regarding the generator processing, here are the steps performed for models integration:
- Add
django-api-generator
as a dependency inrequirements.txt
- Update
configuration->INSTALLED_APPS
section:
INSTALLED_APPS = [
'django_api_gen', # Django API GENERATOR # <-- NEW
'rest_framework', # Include DRF # <-- NEW
'rest_framework.authtoken', # Include DRF Auth # <-- NEW
]
- Create new sections in the project settings
API_GENERATOR = {
'MODEL_API_PATH' : "MODEL_DEFINITION_PATH",
}
REST_FRAMEWORK = {
'DEFAULT_AUTHENTICATION_CLASSES': [
'rest_framework.authentication.SessionAuthentication',
'rest_framework.authentication.TokenAuthentication',
],
}
The most challenging part is to have a controlled injection for each model because the user can activate the API for a single model, all models, or none.
Extended User Model
This feature is something that most of the Django Apps require at some point. To cover this point, the generator empowers the user to define a custom user model using a few defaults:
- name
- phone
- bio
Note: The API generator option is not activated in the UI.
Models Editor
The users can edit and design their database via a simple UI. This is unsupported on AppSeed.
Deployment Ready
All starters generated with Docker support can be deployed via DeployPRO service using a simple flow:
- Authenticate/register into DeployPRO
- Connect your preferred cloud provider
- AWS, Azure or DigitalOcean
- Create a new VPS Server
- this operation takes ~5min
- Deploy the GitHub Repositor (needs ownership)
In less than 10 minutes, if the project has an usable Dockerfile
, the project goes LIVE with an active Ci/CD flow.
Resources
- 👉 Generate Django Apps using
Rocket Generator
- 👉 Join the Community and chat with the
support
team - 👉 Deploy Django on AWS, DO, and Azure using
DeployPRO