> For the complete documentation index, see [llms.txt](https://docs.mernkit.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.mernkit.com/back-end/application-structure.md).

# Application Structure

Below I will list the general API layout. I will not list all functions just a few to give you an understanding of what you will find in each file.&#x20;

* App.js (Entry Point)&#x20;
* nodemon.json (environmental variables used for debugging)
  * Controllers
    * stripe-controller.js (Stripe middleware functions)&#x20;
      * Get Plan Options &#x20;
      * Get Subscription Status...&#x20;
    * users-controller.js (User  middleware functions)&#x20;
      * Get Users
      * Get Permissions...
  * Middleware
    * passport.js&#x20;
      * Facebook Authentication Strategy
      * Google Authentication Strategy&#x20;
      * JWT Authentication Strategy...&#x20;
  * Models
    * http-error.js&#x20;
      * Wrapper for error responses.&#x20;
    * tenant.js
      * Mongoose Model for Tenants
    * users.js
      * Mongoose Model for Users
  * Routes
    * stripe-routes.js
      * routes to controller methods starting with /api/stripe
    * users-routes.js
      * routes to controller methods starting with /api/users
  * Shared
    * email.js
      * wrapper methods for mailgun transactional emails
    * helper.js
      * method to handle potential tenant name collisions
    * stripe.js
      * wrapper methods for strip operations
        * Cancel Subscription
        * Update Subscription...


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.mernkit.com/back-end/application-structure.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
