Skip to content
 
 

Latest commit

 

History

125 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FriendshipWorks Repository

This workspace has been generated by Nx, a Smart, fast and extensible build system.

Setup

Clone this repo and run yarn at the root to install this project's dependencies.

You can optionally install nx globally with npm install -g nx - if you don't, you'll just need to prefix the commands below with npx (e.g. npx nx serve frontend).

Database Setup

This project uses PostgreSQL. You'll need a running Postgres instance before starting the backend.

Option A — Docker (recommended for local dev):

docker run --name scaffolding-db \
  -e POSTGRES_USER=postgres \
  -e POSTGRES_PASSWORD=postgres \
  -e POSTGRES_DB=[DB NAME HERE] \
  -p 5432:5432 \
  -d postgres:15

Option B — pgAdmin / existing Postgres install:

Create a new database (e.g. jumpstart) through pgAdmin or psql.

Configure connection strings:

Copy example.env to .env and fill in your credentials:

cp example.env .env
NX_DB_HOST=localhost
NX_DB_PORT=5432
NX_DB_USERNAME=postgres
NX_DB_PASSWORD=postgres
NX_DB_DATABASE=[DB NAME HERE]

Run migrations:

yarn migration:run

To generate a new migration after changing entities:

name=your_migration_name yarn migration:generate

Windows users: The name=... syntax above only works on Mac/Linux. On Windows, run set name=your_migration_name && yarn migration:generate in Command Prompt, or $env:name="your_migration_name"; yarn migration:generate in PowerShell.

To revert the most recent migration:

yarn migration:revert

Start the app

To start the development server run nx serve frontend. Open your browser and navigate to http://localhost:4200/. Happy coding!

Running tasks

To run just the frontend (port 4200):

nx serve frontend

To run just the backend (port 3000):

nx serve backend

To run both the frontend and backend with one command:

nx run-many -t serve -p frontend backend

Running the mobile app (Expo)

The mobile app (apps/mobile-frontend) is a React Native + Expo app managed via the @nx/expo Nx plugin.

Prerequisites:

  • Expo Go installed on a physical iOS/Android device, or Xcode (iOS Simulator) / Android Studio (Android Emulator) if you want a simulator/emulator instead.

Start the dev server:

nx serve mobile-frontend

This starts the Metro bundler and prints a QR code — scan it with Expo Go, or press i/a in the terminal to launch the iOS Simulator / Android Emulator. (Shortcut: yarn mobile.)

To run directly on a specific platform:

nx run-ios mobile-frontend
nx run-android mobile-frontend

Note: nx build mobile-frontend triggers a cloud EAS build (requires eas login and an Expo account) — it is not a local bundle build. For local export/validation (what CI runs), use nx export mobile-frontend.

Swagger

The backend can expose Swagger UI (built from an OpenAPI document via @nestjs/swagger) so you can browse and try HTTP routes without reading controller code first.

Turn it on: In .env at the repo root (copy from example.env), set SWAGGER_ENABLED=true. Restart the backend (nx serve backend), then open http://localhost:3000/api for the UI.

Turn it off: Unset SWAGGER_ENABLED or set it to false.

TL TODOS:

  1. In apps/backend/src/main.ts, replace [YOUR_APP_NAME] and other [TL] strings, adjust .addTag() entries to match your controllers,
  2. Add @ApiBearerAuth() onto the controller or handler for specifically protected routes. addBearerAuth() only states that the application supports authentication via HTTP Bearer in the Authorization header, it doesn't mark specific routes as protected. Learn more

Decorators to know as you add routes! (import from @nestjs/swagger):

  • @ApiProperty() / @ApiPropertyOptional(): on top of DTO fields
  • @ApiTags('Name'): on top of controllers to tag them to specific tags/features
  • @ApiHeader({name: '...', description: '...'}): on top of individual methods or controllers to define custom headers that are expected as part of the requests to those methods/controllers
  • @ApiResponse({ status: '...', description: '...' }): to define a custom HTTP response.

More Decorators.

Other commands

Run git submodule update --remote to pull the latest changes from the component library

When cloning the repo, make sure to add the --recurse-modules flag to also clone the component library submodule (e.g. git clone --recurse-submodules https://github.com/Code-4-Community/scaffolding.git for the scaffolding repo)

About

friendshipworks (fw) repo

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages