Links

Development Setup

Guide to setup the development environment for the Community Platform

Using Docker Compose

Make sure you have the git command-line tool and Docker installed first, then run the following commands :
# Clone the repo
git clone https://github.com/AstroPlant/community-platform
cd community-platform
# Start up both strapi and next
docker-compose up -d
Once it's finished you should be asked to create a strapi admin account on localhost:1337. Please create at least an article, a user and add the correct permissions by following the steps here. Then you should be able to access the front end on your localhost:3000.

Without Docker

Back-End

1. Set up environment variables

First, generate a secure token.
openssl rand 64 | base64 # (linux/macOS users)
# or
node -e "console.log(require('crypto').randomBytes(64).toString('base64'))" # (all users)
Create an env.local file at the root of this folder with the following content :
ADMIN_JWT_SECRET=token_generated_above

2. Setup a Postgres database

  1. 1.
    Install PostgreSQL.
Please follow the steps presented on the PostgreSQL website to install Postgres.
2. Create a database & a user
# Activating PSQL
psql postgres
# Create the strapi db
CREATE DATABASE strapi;
# Create a user
CREATE ROLE strapi WITH LOGIN PASSWORD 'strapi' CREATEDB;
# Grant all priviledge to the strapi user
GRANT ALL PRIVILEGES ON DATABASE strapi TO strapi;

3. Install Strapi

From then you should be able to install and launch our strapi app with the following commands :
# Clone the repo
git clone https://github.com/AstroPlant/community-platform
cd community-platform/api
# install strapi dependencies
npm install
# Start up strapi
npm run develop
When Strapi is installed you should be asked to create a Strapi admin account on your localhost:1337.

Front-End

Create env files
Create an env.local file at the root of the project with the following content :
NEXT_PUBLIC_STRAPI_PUBLIC_URL="http://localhost:1337"
NEXT_PUBLIC_STRAPI_CLUSTER_URL="http://localhost:1337"
Install the package
Run the following commands :
# Clone the repo
git clone https://github.com/AstroPlant/community-platform
cd community-platform/api
# install strapi dependencies
npm install
# Start up strapi
npm run develop
When strapi is installed you should be asked to create a strapi admin account on your localhost:1337.
Then you should be able to install and boot next on localhost:3000.
cd ..
# install next dependencies
npm install
# Start up strapi
npm run dev
Last modified 2yr ago