Prepare for any occasion with comprehensive weather forecasts from any device with a web browser.
This was my first project after spending 7 years working at the same large company doing things a very specific way. It has quite a few questionable decisions, some hipster library choices, and a fair bit of Not Invented Here syndrome. It is a decent enough showcase but shouldn't be taken as a recommendation for how to build a web app. If I were to do this project over again, I would probably build it as a single page app and use technologies like vite, tailwind, and the many solid libraries in the react ecosystem.
This project requires a recent version of Node.js and npm to build.
The following commands are available through npm run:
clean: Remove all build artifacts from the project directory.build: Run the build process for all client and server side source code in the project.build:client: Build just the client side source code.build:server: Build just the server side source code.build:digitalocean: A special variation of thebuildfor use in a DigitalOcean app.
dev: Run a development server with live reload.start: Build the project and start a server.start:dev: A supporting command fordevnot intended to be used on its own.start:digitalocean: A special variation of thestartfor use in a DigitalOcean app.
test: Run the project's unit tests.
To get started with the project, clone the repository and run npm i --no-save && npm run dev.
This project is itself free software, but depends on a number of proprietary services to work.
In order for Outside to perform location related operations and fetch weather forecast data, it must be configured with:
- An Apple developer team.
- A MapKit JS app identifier and key.
- A WeatherKit REST app identifier and key.
These prerequisites require a paid Apple Developer account and can be created on the portal for said account.
Once these prerequisites have been created, the following environment variables must be set:
APPLE_TEAM_ID: An Apple developer team.APPLE_MAPS_APP_ID: A MapKit JS app identifier.APPLE_MAPS_KEY_ID: A MapKit JS key identifier.APPLE_MAPS_KEY: A MapKit JS REST private key downloaded from the developer portal.APPLE_WEATHER_APP_ID: A WeatherKit REST app identifier.APPLE_WEATHER_KEY_ID: A WeatherKit REST key identifier.APPLE_WEATHER_KEY: A WeatherKit REST private key downloaded from the developer portal.
In order for Outside to fetch air quality data, it must be configured with a Google Maps platform API key. Once an API key has been created, the following environment variable must be set:
GOOGLE_MAPS_API_KEY: A Google Maps platform API key with access to both the Air Quality and Pollen data features.
In order for Outside to be able to send user account emails, it must be configured with a Mailtrap API key. Once an API key has been created, the following environment variable must be set:
MAILTRAP_API_KEY: A Mailtrap platform API key.MAILTRAP_SENDER: The email address which is nominally sending emails from Outside.
In order for Outside to allow users to sign in, it must be configured with the following environment variables:
SESSION_SECRETS: A comma-separated list of secrets to sign session cookies with.SALTS: A comma-separated list of salts for passwords. The first salt in the list used for new password entries.DATABASE_URL: URL for the PostgreSQL server to connect to including username, password, and port.
To set up postgres for local development on macOS, install it with homebrew:
brew install postgresqlOnce installed, you can start the server:
brew services start postgresqlNext, enter into an interactive session:
psql postgresCreate a user for outside:
create role outside with password 'alpine' login;Then create a database for outside:
create database outside with owner outside;It should then be possible to set the DATABASE_URL environment variable like so:
DATABASE_URL="postgres://outside:alpine@localhost:5432/outside"
The following environment variables may be provided:
PORT: The port to publish the HTTP server on. Defaults to8000.HOST: The unqualified hostname of the app. Defaults tolocalhost.DAILY_FORECAST_LIMIT: The number of days to include in the forecast. Defaults to7.HOURLY_FORECAST_LIMIT: The number of hours to include in the forecast. Defaults to24.DAILY_POLLEN_FORECAST_LIMIT: The number of days to include in the pollen forecast. Defaults to3.DISABLE_SIGN_UP: Disables sign up functionality.ANALYTICS_SCRIPTS: A colon separated list of script analytics URLs.
All environment variables may be provided in a .env file.
To run the server locally, execute npm run dev in the project directory.