### Start the local documentation server Source: https://docs.streetmix.net/contributing/documentation Starts the Docusaurus development server from the docs directory. It watches and rebuilds most changed files automatically. ```shell-session npm start ``` -------------------------------- ### Install PostGIS with Homebrew Source: https://docs.streetmix.net/contributing/code/local-setup Installs PostGIS using Homebrew. This is a required prerequisite for the local Streetmix setup. ```shell-session brew install postgis ``` -------------------------------- ### Install documentation dependencies Source: https://docs.streetmix.net/contributing/documentation Install Node.js dependencies for the docs subdirectory. This is separate from the main Streetmix app dependencies. ```shell-session npm install ``` -------------------------------- ### Start Docusaurus directly Source: https://docs.streetmix.net/contributing/documentation Alias for 'npm start' that runs the Docusaurus CLI directly. Either command can be used. ```shell-session npx docusaurus start ``` -------------------------------- ### Install PostgreSQL with Homebrew Source: https://docs.streetmix.net/contributing/code/local-setup Installs PostgreSQL using Homebrew. This is one of the prerequisites for running Streetmix locally. ```shell-session brew install postgres ``` -------------------------------- ### Install Node.js with Homebrew Source: https://docs.streetmix.net/contributing/code/local-setup Installs Node.js using Homebrew. Streetmix uses the latest Active LTS in production, but locally any Current or Active version should work. ```shell-session brew install nodejs ``` -------------------------------- ### Sample .env file Source: https://docs.streetmix.net/contributing/code/local-setup A sample .env file showing example values for AUTH0_CLIENT_ID, AUTH0_CLIENT_SECRET, PELIAS_API_KEY, and PELIAS_HOST_NAME. These are placeholder values and should be replaced with real credentials. ```bash AUTH0_CLIENT_ID=1234567890 AUTH0_CLIENT_SECRET=abcdefghij PELIAS_API_KEY=a2c4e6g8i PELIAS_HOST_NAME=api.geocode.earth ``` -------------------------------- ### Generate pseudo-random numbers with seedrandom and generateRandSeed Source: https://docs.streetmix.net/contributing/code/reference/helpers Use this snippet to create a seeded pseudo-random number generator. Call generateRandSeed() to get an integer seed, then pass it to seedrandom() to obtain a function that returns a consistent sequence of numbers. The example shows that two generators with the same seed produce the same sequence. ```javascript import seedrandom from "seedrandom"; import { generateRandSeed } from "./util/random"; function doThingsWithThePRNG() { const seed = generateRandSeed(); const prng1 = seedrandom(seed); // Generate pseudo-random numbers. Each time rng() is called, it returns // the next pseudo-random number in the sequence. console.log(prng1()); // -> first pseudo-random number console.log(prng1()); // -> second pseudo-random number // .. etc // Create another generator with the same seed const prng2 = seedrandom(seed); console.log(prng2()); // -> same value as the first call to prng1() } ``` -------------------------------- ### Copy .env.example to .env Source: https://docs.streetmix.net/contributing/code/local-setup Creates a new .env file by copying the template .env.example in the Streetmix root directory. ```shell-session cp .env.example .env ``` -------------------------------- ### Install Homebrew package manager Source: https://docs.streetmix.net/contributing/code/local-setup Command to install Homebrew on Mac OS X using the official installation script. This is optional but recommended for easier package management. ```shell-session /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" ``` -------------------------------- ### Set PostgreSQL credentials in .env Source: https://docs.streetmix.net/contributing/code/local-setup Example .env file content for setting PostgreSQL username and password. This is optional for most environments. ```bash PGUSER=streetmix_user PGPASSWORD=streetmix ``` -------------------------------- ### Initialize PostgreSQL databases Source: https://docs.streetmix.net/contributing/code/local-setup Creates and migrates the development and test databases using Sequelize. Both databases are required to run Streetmix. ```shell-session npx sequelize db:create npx sequelize db:migrate NODE_ENV=test npx sequelize db:create NODE_ENV=test npx sequelize db:migrate ```