Use LoopBack's standard project structure to make it easier to develop and maintain your projects.
LoopBack project files and directories are in the application root directory. Within this directory the standard LoopBack project structure has these sub-directories:
server- Node application scripts and configuration files.
common- Files common to client and server. The
definitions- API and product definition YAML files (IBM API Connect only).
/common/models directory. Server-only files go in
/server/models, and client-only go in
|File or directory||Description||How to access in code|
|Top-level application directory|
||Contains Node packages as specified as dependencies in
||Standard npm package specification. See package.json.||N/A|
||Stub file for internal documentation.||N/A|
|/server directory - Node application files|
||Add scripts to perform initialization and setup. See boot scripts.||Scripts are automatically executed in alphabetical order.|
||Server-only model definitions.||Node:
||Specifies LoopBack components to load.||Created by Strongloop tools only. Not used in API Connect.|
||Application settings. See config.json.||
||Data source configuration file. See datasources.json. For an example, see Create new data source.||
||Middleware definition file. For more information, see Defining middleware.||N/A|
||Middleware definition file with development configuration. For more information, see Defining middleware. See Preparing for deployment.|
||Model configuration file. See model-config.json. For more information, see Connecting models to data sources.||N/A|
||Main application program file.||N/A|
|/client directory - Client application files|
|README.md||LoopBack generators create empty
|/common directory - shared application files|
Custom model files:
The LoopBack model generator
automatically converts camel-case model names (for example MyModel) to lowercase dashed names (my-model).
For example, if you create a model named “FooBar” with the model generator, it creates files
However, the model name (“FooBar”) will be preserved via the model’s name property.