# Medusa.js Hosting Reference Guide
Our TurboStack is equipped to handle your optimized MedusaJS application! 

We maintain the server and infrastructure, but MedusaJS configuration, themes, plugins, and customizations are your responsibility.

This guide will inform you about the filestructure, permissions, caching and more, of your MedusaJS application.

## File Structure

The following table shows the directory structure of a Medusa.js application:

| Path                 | Purpose |
|----------------------|---------|
| `src/admin`          | Holds your admin dashboard's custom widgets and UI routes. |
| `src/api`            | Holds your custom API routes that are added as endpoints in your Medusa application. |
| `src/jobs`           | Holds your scheduled jobs that run at specified intervals during the application's runtime. |
| `src/links`          | Holds your module links that build associations between data models of different modules. |
| `src/modules`        | Holds your custom modules that implement business logic. |
| `src/scripts`        | Holds your custom scripts to be executed using Medusa’s CLI tool. |
| `src/subscribers`    | Holds your event listeners that run asynchronously whenever an event is emitted. |
| `src/workflows`      | Holds your custom flows that can be executed from anywhere in your application. |
| `medusa-config.ts`   | Holds your Medusa configurations, such as PostgreSQL database configuration. |
| `.medusa`            | Holds types and other files generated by Medusa when running `build`; should not be modified or committed. |

## Permissions

MedusaJS requires correct file permissions to operate securely and reliably:

```bash
find ~/<Project>/<Shopname> -type f -exec chmod 644 {} \;
find ~/<Project>/<Shopname> -type d -exec chmod 755 {} \;
chown -R $USER:$USER ~/<Project>/<Shopname>
```
> **Note:** Replace `<Project>` and `<Shopname>` with your actual project and shop name.

## Caching

### Configuring Redis
You can find our documentation on how to set up Redis [here](../../Caching/redis.md)

### Varnish
The Medusa.js dashboard does not need any caching. We do recommend adding varnish to your storefront.

You can enable Varnish in our TurboStack GUI by adding the following line to the YAML configuration, for the `vhost` where your frontend resides.

```yaml
varnish_enabled: true
```
### Clearing the cache
To clear the caches, run the following commands:
```bash
tscli varnish clear
tscli redis clear
```

---
