Project structure

Understand the files and folder structure of an Epic API project.

This page provides an overview of the Epic API project's file and folder structure. It covers all the files and folders within the project.

Main top-level files

File
Description

deno.json

Deno configuration file.

import_map.json

Project's import map file.

serve.ts

The main entry point of the project.

database.ts

Contains a database class for setting up a custom database driver. By default, Epic API uses MongoDB with Mongoose ODM. See how to change the database here.

.sample.env

Sample environment file. A sample env file is used to create the default environment files. This file can also be used to add the dummy environment variables in a plugin context.

index.d.ts

Project's type declaration file, used to override the default typing. This file also also used to load the plugin's typing in the main project.

plugins.d.ts

This file is used to load the plugin's typing into the main project. Do not edit this file.

Dockerfile

A default docker file that you can use to build a docker image of an Epic API application. See how to use docker.

docker-compose.yml

You can quickly spin up a docker container using this default docker-compose file.

i18next.ts

Contains an i18next class that is used in the project internally for API response translations

Misc files

File
Description

.sequence.json

In Epic API, resource logic like (controllers, models, middleware etc.) are loaded in the project automatically. This file allows you to control, how these files should be loaded.

Top-level folders

Folder
Description

env

This folder contains the environment variable files.

controllers

This folder contains your controller files. A controller is a class that contains your application's services and routes. The main business logic of your application lives here.

models

This folder contains the database models. By default, the Epic API consumes MongoDB with its built-in ODM.

middlewares

This folder contains the request middlewares consumed by Oak.

hooks

It contains the request interceptor (hook) logic, which is executed before and/or after the request handler execution.

jobs

This folder contains the logic of your application that will be executed only once, when the application is started.

plugins

Epic API supports the popular plugin system like WordPress! This feature enables developers to write minimal code and use existing logic to build faster.

assets

Keep your project assets and resources in this folder. This folder also keeps the assets in a plugin context, and they are automatically resolved for a specific plugin.

core

This folder contains the core logic of an Epic API project, which is automatically handled by the framework. It is not recommended to modify the code in this folder.

public

Want to serve static content like a React.js application, HTML, or other files? This folder contains your static websites. See the static website server docs for more details.

templates

Epic API promotes less coding development, allowing you to create/consume template code in this folder. Execute the deno task create command to use these templates.

terraform

This folder contains your terraform configuration.

tests

This folder contains your application's test files. Testing is important for a production application.

Last updated

Was this helpful?