To get started with the project, follow these steps:
-
Clone the repository:
git clone git@github.com:digdir/norge.no.git
-
Navigate to the project directory:
cd norge.no
-
Set correct environment variables in the cms directory:
cp ./apps/cms/.env.example ./apps/cms/.env
Update the
.env
file with your desired configuration. -
Set correct environment variables in the frontend directory:
cp ./apps/frontend/.env.example ./apps/frontend/.env
-
Update the
.env
file with your desired configuration. You can find the StrapiSTRAPI_API_KEY
in the Strapi admin panel under Settings > API Tokens when running the cms application.
-
Make sure you have the required tools installed.
- Deno (for workspace and Astro)
- Node.js (for Strapi)
- pnpm (for Strapi)
- Docker (for running the database)
- Docker Compose
-
Install the workspace dependencies:
deno install --allow-scripts=npm:sharp@0.33.5
-
For simplicity use sqlite for development without containers. To do this:
a. Uncomment the variables underDatabse configuration for SQLite
in theapps/cms/.env
file
b. Commnet out the variables underDatabase configuration for Postgres
. -
Install the cms dependencies:
deno task cms:install
-
Start the cms development server:
deno task cms:dev
-
Open your browser and go to
http://localhost:1337
to see the application running.
-
Open a new terminal at the project directory
-
Start the cms development server:
deno task frontend:dev
-
Open your browser and go to
http://localhost:4321
to see the application running.
-
Build the cms app locally due to some compatibility issues with the latest version of Strapi and the Docker image:
deno task cms:build
-
Start the
cms
andcms-db
services first to create and store an api key in the database which will be used later by the frontend application:docker-compose up --build cms cms-db
-
Go to the Strapi admin panel at
http://localhost:1337/admin
and create an API key under Settings > API Tokens. Copy the API key. and paste it in the.env
file of the frontend application in theSTRAPI_API_KEY
variable. -
Start the frontend service in a new terminal:
docker-compose up --build frontend
(Optional) Alternatively, you can run all three services together by running the following command in a new terminal:
docker-compose up --watch --build
This will start all three services, but rebuild the frontend service automatically when the
./apps/frontend/.env
file changes after you add theSTRAPI_API_KEY
variable (step 2). -
Open your browser and go to
http://localhost:1337
for the cms andhttp://0.0.0.0:8085
for the frontend to see the applications running.
Learn how you can contribute to this project by reading our Code of Conduct and Contributing Guide.