npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@bloom-housing/backend-core

v7.6.0

Published

Listings service reference implementation for the Bloom affordable housing system

Downloads

13

Readme

Bloom Backend Services

This package is a NestJS application that provides a core set of backend services via REST API endpoints to apps using the Bloom Housing framework. Information is stored in a Postgres database, accessed via TypeORM.

OpenAPI Documentation

OpenAPI (fka Swagger) documentation is automatically generated by the server at http://localhost:3100/docs/ for a standard local development environment. A raw JSON version of the schema is also available at /docs-json/, suitable for API client code generation or other code-based consumers.

Getting Started

  • Install Node.js 14.x brew install node@14.
  • Install Postgres 12 brew install postgresql
  • Copy the .env.template within backend/core to .env and edit variables appropriate to your local environment. Ensure sure the Database URL and Test Database URL match your Postgres configuration.
  • Install dependencies yarn install within backend/core

Seeding the Database

There are two databases used in this project: bloom and bloom_test. The first is used every time you are starting a project with yarn dev and second one is only used in end-to-end tests. Corresponding TypeORM configs are defined in ormconfig.ts and ormconfig.test.ts. If you are just starting to work with the projects it's best to simply run:

yarn && yarn db:reseed

which will create the bloom DB for you, migrate it to the latest schema, and seed with appropriate dev data. If running the reseed command requires that you input a password for Postgres, set the following environment variables: PGUSER to postgres and PGPASSWORD to the default password you inputted for the postgres user during Postgres installation. If you get the FATAL: database "<user>" does not exist error please run: createdb <user> first.

Dropping the DB:

yarn db:drop

Creating the DB:

yarn db:create

Seeding the DB:

yarn db:seed

Generating a new migration:

yarn db:migration:generate

Applying migrations:

yarn db:migration:run

Running Tests

End-to-end tests:

yarn test:e2e:local

Unit tests:

yarn test

Translations

The backend keeps translations for email related content in the DB in the translations table. The /translations endpoint exposes CRUD operations on this table (admin only). Translations are defined for each county code and language pair e.g. (Alameda, en). To modify a particular translation pair:

  1. Fetch GET /translations and list all the translations
  2. Find an ID of a pair that interest you
  3. Use PUT /translations/:translationId to modify it's content

Environment Variables

| Name | Description | Default | Type | | ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------- | ----------------------------- | | PORT | Port number the server will listen to for incoming connections | 3100 | number | | NODE_ENV | Controls build optimization and enables some additional logging when set to development | development | "development" | "production" | | DATABASE_URL | Database connection | postgres://localhost/bloom | string | | TEST_DATABASE_URL | Test database connection | postgres://localhost/bloom_test | string | string | | THROTTLE_TTL | Rate limit TTL in seconds (currently used only for application submission endpoint) | 60 | number | | THROTTLE_LIMIT | Max number of operations in given time window THROTTLE_TTL after which HTTP 429 Too Many Requests will be returned by the server | 2 | number | | EMAIL_API_KEY | Sendgrid API key (see sendgrid docs for creating API keys | Available internally | string | | APP_SECRET | Secret used for signing JWT tokens (generate it with e.g. openssl rand -hex 48) | Available internally | string | | PARTNERS_PORTAL_URL | URL for partners site | http://localhost:3001 | string |