A robust, scalable API built with AdonisJS and TypeScript, designed for modern web applications.
- AdonisJS 5: Modern Node.js MVC framework with TypeScript support.
- Comprehensive CRUD Factory: Instantly generate models, controllers, migrations, factories, validators, and functional tests for any entity.
- Extensive Functional Testing: Uses @japa/runner for end-to-end and API tests.
- Modular Structure: Clean separation of concerns for scalability and maintainability.
-
Install dependencies
yarn install
-
Configure environment
- Copy
.env.exampleto.envand fill in the required variables. - See
env.tsfor all required environment variables.
- Copy
-
Run migrations & seeders
yarn mf # Fresh migration yarn mfs # Fresh migration with seeders
-
Start the development server
yarn dev
Easily scaffold a full CRUD flow for any entity using the custom Ace command:
node ace crud <EntityName>- Generates:
- Model (
app/Models/) - Controller (
app/Controllers/Http/) - Migration (
database/migrations/) - Factory (
database/factories/) - Validator (
app/Validators/) - Functional Test (
tests/functional/)
- Model (
Example:
node ace crud Country
node ace crud Country --interactiveAll tests are written with @japa/runner and live in tests/functional/.
yarn test
# or
node ace test- Functional Coverage: Every CRUD endpoint, authentication flow, and business rule is covered by functional tests.
- Factories: Test data is generated using AdonisJS factories for realistic and isolated scenarios.
- Role-based Testing: Many tests check both admin and regular user permissions, ensuring robust access control.
- Setup & Teardown: Each test group uses a
cleanAllsetup to ensure a clean database state. - Assertions: Tests assert HTTP status codes, response bodies, and side effects (like DB changes or emails sent).
- Grouped by Resource: Each
.spec.tsfile targets a specific resource (e.g.,users,novels,contacts). - Example Test:
test('create a country', async ({ client }) => { const admin = await UserFactory.apply('admin').create() const data = { name: 'Turkey', key: 'TR' } const response = await client.post('/countries').loginAs(admin).form(data) response.assertStatus(200) response.assertBodyContains(data) })
- Plugins & Reporters:
- Uses
@japa/preset-adonisfor assertions, API client, and failed test reruns. - Spec reporter for detailed terminal output.
- Uses
- Automated Setup:
- Migrations and seeders run automatically before tests.
- HTTP server starts for functional suites.
- Test utilities: Common helpers (like
cleanAll) are intests/utils/. - Email and notification flows are tested using AdonisJS mail fakes and notification assertions.
- Reports and analytics endpoints are covered with realistic data and assertions.
node ace crud <EntityName>– Scaffold full CRUD for an entitynode ace test– Run all testsnode ace migration:run– Run migrationsnode ace db:seed– Seed the database
See all available commands:
node ace listBuilt with care by:
- İlker SARI
- Emre DEĞER
- Yiğit Can DENLİ
- Ömer ALPI
This repo is now archived.
We’re leaving the lights on. Just in case someone forgets their keys. 🗝️
MIT