> For the complete documentation index, see [llms.txt](https://piramal-swasthya.gitbook.io/uba/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://piramal-swasthya.gitbook.io/uba/toasters/provider-toaster/developer-guide/backend-guide/strapi-provider/build-and-run-guide.md).

# Build and Run Guide

## A. Running Locally without Docker

1. Clone and Setup:

   <pre class="language-bash" data-overflow="wrap"><code class="lang-bash">git clone https://github.com/PSMRI/ubi-strapi-provider.git
   cd ubi-strapi-provider/strapi
   nvm use 18  # Ensure correct Node version
   npm install  # Using npm as specified in project setup
   </code></pre>
2. Configure Environment:

   ```bash
   cp .env.example .env
   ```

   Update .env with required configuration:

   <pre class="language-bash" data-overflow="wrap"><code class="lang-bash"># Strapi DB
   DATABASE_CLIENT=postgres
   DATABASE_HOST=127.0.0.1
   DATABASE_PORT=5432
   DATABASE_NAME=uba_provider
   DATABASE_USERNAME=strapi_db_user
   DATABASE_PASSWORD=strapi_db_pass

   # Strapi Secrets (Generate using: openssl rand -base64 32)
   JWT_SECRET=
   APP_KEYS=
   API_TOKEN_SALT=
   ADMIN_JWT_SECRET=
   TRANSFER_TOKEN_SALT=
   </code></pre>
3. Start PostgreSQL Database:

   ```bash
   docker-compose up postgres -d
   ```
4. Start Development Server:

   <pre class="language-bash" data-overflow="wrap"><code class="lang-bash">cd strapi
   npm run develop  # Using npm as specified in project setup
   </code></pre>

## B. Running with Docker

1. Configure Environment:

   ```bash
   cp .env.example .env
   ```

   Additional Docker-specific variables:

   ```bash
   # PGAdmin (if needed)
   PGADMIN_DEFAULT_EMAIL=
   PGADMIN_DEFAULT_PASSWORD=

   # Set to production for Docker deployment
   NODE_ENV=production
   ```
2. Start Database Services:

   ```bash
   # Start PostgreSQL and PgAdmin
   docker-compose up postgres pgadmin -d
   ```
3. Build and Start Strapi:

   ```bash
   # Build fresh image
   docker-compose build --no-cache strapi

   # Start Strapi service
   docker-compose up strapi -d
   ```
4. Monitor and Manage:

   ```bash
   # View logs
   docker-compose logs -f strapi

   # Stop all services
   docker-compose down
   ```

## Access Points

* Admin Panel: <http://localhost:1337/admin>
* API Documentation: <http://localhost:1337/documentation>
* API Endpoints: <http://localhost:1337/api/>
  * Use `?populate=*` to get all component details

## Project Structure

Key files for deployment:

* `Dockerfile` - Strapi container configuration
* `docker-compose.yml` - Service orchestration
* `deploy.sh` - Deployment script

## Reference Documentation

* [Strapi Quick Start Guide](https://docs.strapi.io/cms/quick-start)
* [Strapi Docker Guide](https://docs.strapi.io/cms/installation/docker)
* [Project Repository](https://github.com/PSMRI/ubi-strapi-provider)

## Important Notes

1. The project uses npm for package management.
2. TypeScript is enabled by default
3. PostgreSQL SSL is disabled by default
4. Custom collections can be created via Strapi admin UI
5. Node.js version 18.x is required


---

# 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://piramal-swasthya.gitbook.io/uba/toasters/provider-toaster/developer-guide/backend-guide/strapi-provider/build-and-run-guide.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.
