Skip to content

Commit

Permalink
Merge pull request #84 from IntersectMBO/pre-prod
Browse files Browse the repository at this point in the history
Pre prod
  • Loading branch information
teske00 authored Jul 16, 2024
2 parents 3dc2605 + 95de740 commit 905a8fc
Show file tree
Hide file tree
Showing 73 changed files with 70 additions and 18,050 deletions.
75 changes: 25 additions & 50 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,26 @@
# Boilerplate Project Documents
# 🚀 PDF (Proposal Discussion Forum) backend

Welcome to the official repository for the Web App Boilerplate.
Welcome to the official repository for the PDF backend.

## Table of content:

- [Boilerplate Project Documents](#boilerplate-project-documents)
- [Table of content:](#table-of-content)
- [Introduction](#introduction)
- [Prerequisites](#prerequisites)
- [Tech stack:](#tech-stack)
- [Backend](#backend)
- [Database](#database)
- [Frontend](#frontend)
- [Getting started](#getting-started)
- [Running locally](#running-locally)
- [Backend setup](#backend-setup)
- [Database configuration](#database-configuration)
- [Frontend setup](#frontend-setup)
- [Additional Information](#additional-information)
- [Running using docker compose](#running-using-docker-compose)
- [Overview of services in docker compose:](#overview-of-services-in-docker-compose)
- [Table of content:](#table-of-content)
- [Introduction](#introduction)
- [Prerequisites](#prerequisites)
- [Tech stack:](#tech-stack)
- [Backend](#backend)
- [Database](#database)
- [Getting started](#getting-started)
- [Running locally](#running-locally)
- [Backend setup](#backend-setup)
- [Database configuration](#database-configuration)
- [Running using docker compose](#running-using-docker-compose)
- [Overview of services in docker compose:](#overview-of-services-in-docker-compose)
- [Additional Information](#additional-information)

## Introduction

This document serves as a comprehensive guide for setting up the full stack of our application, which includes the backend, frontend, and database components.
This document serves as a comprehensive guide for setting up the backend and database components of our application.

## Prerequisites

Expand All @@ -37,8 +34,6 @@ This document serves as a comprehensive guide for setting up the full stack of o

**Database:** [PostgreSQL](https://www.postgresql.org/)

**Frontend:** [Next.js](https://nextjs.org/)

**Container:** [Docker](https://docs.docker.com/get-started/)

### Backend
Expand All @@ -49,12 +44,6 @@ Our backend is powered by Strapi, a versatile headless CMS built on Node.js. It

For data persistence, we utilize PostgreSQL, known for its robustness, scalability, and reliability. This choice ensures that our application's data layer is secure, efficient, and capable of handling growth.

### Frontend

The frontend is developed with Next.js, a React framework that allows for server-side rendering and static site generation. This choice enables us to create fast, SEO-friendly web pages that integrate seamlessly with our Strapi backend.

The instructions that follow will guide you through setting up each component of our application stack, ensuring a cohesive development and deployment process.

## Getting started

Before you begin setting up the application, you'll need to clone the repository from GitHub to get a local copy of the code. Follow these steps to clone the repository and start setting up the application components:
Expand All @@ -65,15 +54,15 @@ Before you begin setting up the application, you'll need to clone the repository
- Navigate to the directory where you want to store the project.
- Run the following command to clone the repository:
```
git clone https://github.com/IntersectMBO/boilerplate-project.git
git clone https://github.com/IntersectMBO/govtool-proposal-discussion.git
```

2. **Navigate to the Project Directory:**
- After cloning, change into the project's root directory:
```
cd boilerplate-project
cd govtool-proposal-discussion
```
This directory contains all the files you need to set up the application, including the Docker Compose files and the separate directories for the backend and frontend components.
This directory contains all the files you need to set up the backend.

By cloning the repository, you ensure that you have the latest version of the code and all the necessary files to get started with the application setup.

Expand All @@ -94,23 +83,6 @@ To run the application locally, you need to have Node.js installed for the backe
2. **Create a new database** for the project, noting down the credentials.
3. **Update the `.env` file** in the backend directory with your database credentials (host, port, username, database name, and password).

### Frontend setup

1. **Navigate to the `frontend` directory** of the project.
2. **Install dependencies** by running `npm install`.
3. **Configure Environment Variables:** Create or edit a `.env` file in the frontend directory to include environment variables specific to your Next.js application. For seamless integration with the Strapi backend, add the following line to specify the backend API URL: `NEXT_PUBLIC_API_URL=http://localhost:1337`

4. **Start the Next.js server** with `npm run dev` for development mode. This command serves your frontend application and hot-reloads for any changes.

By following these detailed steps for each part of the stack, you will have a fully functional full-stack application ready for further development and eventual deployment.

### Additional Information

For more detailed information about setting up and running each part of the application, please refer to the README files located in the respective directories:

- [Backend setup](./backend/README.md) - Detailed instructions for setting up the backend part of the application.
- [Frontend setup](./frontend/README.md) - Detailed instructions for setting up the frontend part of the application.

## Running using docker compose

Leverage Docker Compose to simplify the process of deploying the full stack of our application, which includes the backend, frontend, and database. Follow these steps to get everything up and running smoothly:
Expand All @@ -134,7 +106,6 @@ Leverage Docker Compose to simplify the process of deploying the full stack of o
4. **Accessing the application:**
- With all services running, your application components should be accessible at the following URLs:
- **Backend:** `http://localhost:1337` – This is where your Strapi CMS will be accessible for managing content and accessing the API.
- **Frontend:** `http://localhost:3000` – Your Next.js frontend application will be available here, ready to serve your site's visitors.
- **Database:** While the database itself won't be directly accessible via a simple URL (since it's meant to be accessed by your backend service), it's running on a mapped port `4321` on your host machine. This setup is specified in your `docker-compose.yaml` file, allowing secure and straightforward connections from your backend service.

### Overview of services in docker compose:
Expand All @@ -143,6 +114,10 @@ Leverage Docker Compose to simplify the process of deploying the full stack of o

- **Database service:** This service runs PostgreSQL and is set to be accessible on port `4321` from the host machine. It's crucial for storing all your application's data securely and efficiently.

- **Frontend service:** Your Next.js application will be served on port `3000`, connecting to the Strapi backend to fetch content and data. This setup provides a seamless experience for developers and users alike.

By following these steps, you can quickly get your full-stack application running using Docker Compose, ensuring each component is correctly configured and interconnected for optimal performance.

### Additional Information

For more detailed information, check the README file in the backend folder:

- [Backend setup](./backend/README.md) - Detailed instructions for setting up the backend part of the application.
45 changes: 45 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
version: "3"
services:
backend:
container_name: backend # Name of the backend container
build: # Build configuration for the backend
context: ./backend # Directory containing Dockerfile
dockerfile: Dockerfile
image: strapi:latest # Use the latest Strapi image
restart: unless-stopped # Always restart unless explicitly stopped
environment: # Environment variables for configuration
HOST: 0.0.0.0
PORT: 1337
DATABASE_HOST: database # Link to the database service by name
DATABASE_NAME: pdf_db
DATABASE_USERNAME: postgres
DATABASE_PASSWORD: postgres
NODE_ENV: development # Set node environment to development
volumes: # Mount points for persistent data and source code
- ./backend/config:/opt/app/config
- ./backend/public/uploads:/opt/app/public/uploads
ports:
- "1337:1337" # Expose port 1337 to the host
networks:
- strapi # Connect to the 'strapi' network
depends_on:
- database # Depends on the database service
database:
container_name: database # Name of the database container
platform: linux/arm64 # Specify the platform (important for ARM64 architectures)
image: postgres:12.0-alpine # Use PostgreSQL 12 on Alpine for smaller size
restart: unless-stopped
environment: # PostgreSQL user, password, and database name
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: pdf_db
volumes:
- strapi-data:/var/lib/postgresql/data/ # Persistent storage for the database
networks:
- strapi # Connect to the 'strapi' network
volumes:
strapi-data: # Define a volume for PostgreSQL data
networks:
strapi: # Custom network for inter-container communication
name: Strapi
driver: bridge
3 changes: 0 additions & 3 deletions frontend/.eslintrc.json

This file was deleted.

39 changes: 0 additions & 39 deletions frontend/.gitignore

This file was deleted.

27 changes: 0 additions & 27 deletions frontend/Dockerfile

This file was deleted.

Loading

0 comments on commit 905a8fc

Please sign in to comment.