Skip to content

Running Framna Docs Locally

Simon B. Støvring edited this page Sep 9, 2024 · 1 revision

After creating the .env.local file and setting the environment variables as described in the Setting Environment Variables article, you may follow the steps outlined in this section to run Framna Docs locally.

Install prerequisites

Framna Docs persists long-term data in PostgreSQL and caches data in Redis. Therefore you need both PostgreSQL and Redis isntalled in order to run Framna Docs.

Install PostgreSQL and create tables

PostgreSQL can be installed with Homebrew:

brew install postgresql

Alternatively, you may download PostgreSQL from postgresql.org. If you prefer to use a graphical interface for managing your database, you may install Postgres.app.

With PostgreSQL installed, you need to create a database. Do this by running the following command in your Terminal.

createdb framna-docs

Make sure to replace framna-docs with the database name specified in the POSTGRESQL_DB environment variable.

By default, PostgreSQL will create databases under the current user and with an empty database. You can find your username by running the following in the terminal.

whoami

The output of the command should be assigned to the POSTGRESQL_USER environment variable while POSTGRESQL_PASSWORD should be left empty.

Next, connect to the database by running the following command:

psql framna-docs

Make sure to replace framna-docs with the database name specified in the POSTGRESQL_DB environment variable. Create the tables in the database by running the queries in create-tables.sql.

\i create-tables.sql

Verify that the tables have been created using the following command.

\dt

Install Redis

Redis can be installed with Homebrew:

brew install redis

Alternatively, you may download Redis from redis.io.

If you have installed Redis using Homebrew, you may start the server by running the following command.

brew services start redis

Alternatively, you may run the Redis server in the current session using the following command:

redis-server

Ping the Redis server to verify that it is running:

redis-cli ping

The Redis server may be stopped at any time by running:

brew services stop redis

If you have started the server by invoking redis-server, you can stop it with CTRL+C.

Install npm dependencies

With the prerequisites installed, you can proceed to install the Node dependencies using:

npm install

Run the app

Finally, you may run Framna Docs locally with:

npm run dev

Framna Docs should now be reachable on http://localhost:3000 🚀