This repository contains a Strapi v5.x application prepared for the internship assignment.
It includes a sample collection type Article, sample entries, and the minimal project files required to run the app locally.
What this repo contains:
- A Strapi app scaffolded locally
- An
Articlecollection type with fields:title(short text),content(rich text),published(boolean) - Sample article entries created via the Strapi admin UI
- Files pushed to branch
Shantanufor PR
Make sure you have:
- Node.js (LTS recommended) installed
- npm (or yarn)
- Git installed
- (Optional) Docker if you prefer containerized runs
Below are the exact commands used to create, run and push the project. Run these from a terminal in the folder where you want the project.
This is an example used if you want to create a project from scratch. Skip if you already have the project folder.
# Using npm (Strapi installer approach may vary)
npx create-strapi@latest my-strapi-app --quickstart
# or if you want TypeScript or specific options, configure accordinglyIn this assignment we used a standard Strapi project scaffold that results in the project folder:
my-strapi-app/.
Run from the project root:
# If package.json has the develop script
npm run develop
# or with yarn
yarn developThe admin UI opens at:
http://localhost:1337/admin
When prompted on first run, register an admin user (email + password) in the admin UI.
In the browser admin UI:
-
Go to Content-Type Builder → Create collection type.
-
Enter display name:
Article. -
Add fields:
title— Text (Short text)content— Rich Text (or Long Text / Rich Text)published— Boolean
-
Save (Strapi will rebuild admin UI automatically).
- Go to Content Manager → Article → Create new entry
- Fill sample data and click Publish (or Save & Publish).
Example GET (public or role-limited depending on permissions):
# Basic curl while running locally
curl -s http://localhost:1337/api/articles | jq .If jq is not installed you will see JSON raw output:
curl -s http://localhost:1337/api/articlesThe response should include your sample articles.
Commands executed locally to push your changes to the internship repository:
# inside project root
git init # if not already a repo
git remote add origin <repo-url> # set remote to the organization repo
git fetch origin
git checkout -b Shantanu origin/Shantanu # create branch tracking remote (or create new local branch)
# stage and commit your project files (exclude node_modules)
git add .
git commit -m "Add Strapi setup and sample article"
git push -u origin ShantanuAfter git push, open the repository on GitHub and click the green Compare & pull request button to create the PR from branch Shantanu into main (or as instructed by the mentor).
Important: Keep
.envsecrets out of Git..gitignoreshould includenode_modules/,.env, and other local artifacts.
my-strapi-app/
├─ config/
│ └─ ... Strapi config files
├─ database/
│ └─ migrations/
├─ public/
│ └─ static assets (favicon, etc.)
├─ src/
│ ├─ api/
│ │ └─ article/
│ │ ├─ content-types/
│ │ │ └─ article/ # schema JSON for Article
│ │ ├─ controllers/
│ │ ├─ routes/
│ │ └─ services/
│ └─ ... other Strapi source files
├─ types/
│ └─ generated/
│ ├─ contentTypes.d.ts
│ └─ components.d.ts
├─ .env.example
├─ .gitignore
├─ README.md
├─ package.json
├─ package-lock.json
├─ tsconfig.json
└─ favicon.png
- Clone the repo or copy the project folder to your machine:
git clone <org-repo-url>
cd The-Monitor-Hub
git checkout -b Shantanu origin/Shantanu # or git checkout Shantanu if created- Install dependencies:
# from project root
npm install
# or
yarn-
Create
.env(copy.env.exampleto.env) and configure DB / ports if required. -
Run Strapi in dev mode:
npm run develop
# or
yarn develop- Visit
http://localhost:1337/admin, sign in, and you should see yourArticlein Content Manager.
- Admin panel accessible and admin user created.
Articlecollection type added with fields: title, content, published.- Sample entries created and visible via API
GET /api/articles. - Repo pushed to the
Shantanubranch and PR created for review.
Here is a **clean, professional, internship-grade Task-3 README section** you can directly paste under your existing README.md.
This task focuses on setting up a fully containerized environment for Strapi using PostgreSQL as the database and Nginx as a reverse proxy. All services communicate over a user-defined Docker network. The final goal is to access the Strapi Admin panel via http://localhost/admin.
docker network create strapi-netAll containers (PostgreSQL, Strapi, Nginx) will use this network.
docker run -d \
--name strapi-postgres \
--network strapi-net \
-e POSTGRES_USER=strapi \
-e POSTGRES_PASSWORD=strapi123 \
-e POSTGRES_DB=strapi \
-p 5432:5432 \
postgres:15| Key | Value |
|---|---|
| POSTGRES_USER | strapi |
| POSTGRES_PASSWORD | strapi123 |
| POSTGRES_DB | strapi |
Create a .env file in the project root:
HOST=0.0.0.0
PORT=1337
APP_KEYS=appkey1,appkey2
API_TOKEN_SALT=apitokensalt123
ADMIN_JWT_SECRET=adminjwt123
JWT_SECRET=jwtsecret123
ADMIN_AUTH_SECRET=adminauthsecret123
TRANSFER_TOKEN_SALT=transfersalt123
ENCRYPTION_KEY=encryptionkey123
DATABASE_CLIENT=postgres
DATABASE_HOST=strapi-postgres
DATABASE_PORT=5432
DATABASE_NAME=strapi
DATABASE_USERNAME=strapi
DATABASE_PASSWORD=strapi123
FROM node:20-bullseye
WORKDIR /app
# Copy package files and install dependencies
COPY package.json package-lock.json* ./
RUN npm install
RUN npm install pg --save
# Copy the full project
COPY . .
# Build Strapi (build TypeScript → dist/)
RUN npm run build
EXPOSE 1337
# Start Strapi in production mode
CMD ["npm", "run", "start"]docker build --no-cache -t strapi-app .docker run -d \
--name strapi-container \
--network strapi-net \
--env-file .env \
-p 1337:1337 \
strapi-appTo verify logs:
docker logs -f strapi-containerCreate the file:
nginx/nginx.conf
with the following contents:
events {}
http {
server {
listen 80;
location / {
proxy_pass http://strapi-container:1337;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
location /admin/ {
proxy_pass http://strapi-container:1337/admin/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}
}winpty docker run -d \
--name strapi-nginx \
--network strapi-net \
-p 80:80 \
-v "C:/Users/SHANTANU RANA/Desktop/Task-3/The-Monitor-Hub/nginx/nginx.conf:/etc/nginx/nginx.conf:ro" \
nginx:latestCheck logs:
docker logs strapi-nginxExpected:
Configuration complete; ready for start up
Open your browser:
You should now see the Strapi Admin Panel setup screen.
Congratulations — all services are running successfully through Docker!
- Fully Dockerized Strapi application
- PostgreSQL database running in a dedicated container
- Nginx reverse proxy routing requests to Strapi
- A shared Docker network (
strapi-net) for container communication - Production-like local setup
- Admin dashboard accessible via http://localhost/admin