Getting Started with RS Tech Hub Modules
Welcome to RS Tech Hub! This guide will help you get up and running with professionally maintained NestJS infrastructure modules in minutes.
What You'll Build
By following this guide, you'll set up a complete NestJS backend application with:
- User authentication - Secure JWT-based auth with refresh tokens
- User management - Complete user CRUD operations
- Profile system - User profiles with customizable fields
- Account management - Account lifecycle and settings
- GraphQL API - Modern API with Apollo Server
- Database - PostgreSQL with Prisma ORM
All maintained by RS Tech Hub, so you never worry about security patches or dependency updates again.
Prerequisites
Before you begin, make sure you have:
- Docker 4+ - For running PostgreSQL database
- Node.js v24+ - Required for NestJS and modules
- Yarn or npm - Package manager
- Git - For cloning the demo repository
Quick Start (5 Minutes)
Step 1: Clone the Demo Repository
git clone https://github.com/RuffSantiDev/rs-tech-hub-demo-backend.git
cd rs-tech-hub-demo-backend
This demo repo includes a pre-configured NestJS application with all RS Tech Hub modules integrated.
Step 2: Set Up Environment Variables
Database Password
- Copy the database password template:
cp dbpw.dev.secret-template.txt dbpw.dev.secret.txt - Edit
dbpw.dev.secret.txtand add your database password on the first line (no labels, just the password)
Application Environment
- Copy the environment template:
cp .env-template.txt .env - Edit
.envand configure these critical variables:
DATABASE_URL=postgres://admin:YOUR_PASSWORD@localhost:5440/dev
DATABASE_PORT=5440
DATABASE_HOST=localhost
JWT_SECRET=your-random-jwt-secret-here
JWT_REFRESH_SECRET=your-random-refresh-secret-here
SERVICE_TOKEN=your-service-token-here
REQUEST_SIGNING_SECRET=your-signing-secret-here
CSRF_SECRET=your-csrf-secret-here
SESSION_SECRET=your-session-secret-here
BASIC_AUTH_USERNAME=admin
BASIC_AUTH_PASSWORD=your-admin-password
RS_TECH_HUB_NESTJS_STARTER_BUNDLE_LICENSE_KEY=your-license-key-here
Important: Replace all placeholder values with secure random strings. Use openssl rand -base64 32 to generate secure secrets.
Step 3: Start the Database
yarn docker:build:dev
This creates a Docker container with PostgreSQL database:
- Container name:
rs-tech-hub-nestjs-demo-backend - Database service:
nestjs-starter-backend-db - Port:
5440(configured to avoid conflicts with other PostgreSQL instances)
Step 4: Install Dependencies
yarn install
This installs all required packages, including:
- All RS Tech Hub modules
- NestJS core packages
- Prisma ORM
- GraphQL and Apollo Server
- Authentication libraries (Passport, JWT)
Note: If you encounter missing modules after installation, run:
yarn add @rs-tech-hub/nestjs-account-starter@latest @rs-tech-hub/nestjs-auth-core@latest @rs-tech-hub/nestjs-auth-starter@latest @rs-tech-hub/nestjs-clock@latest @rs-tech-hub/nestjs-common-interceptors@latest @rs-tech-hub/nestjs-prisma@latest @rs-tech-hub/nestjs-profile@latest @rs-tech-hub/nestjs-service-operation@latest @rs-tech-hub/nestjs-user@latest @rs-tech-hub/nestjs-test-starter@latest
Step 5: Set Up the Database Schema
The schema is already pre-generated in /generated/.prisma.
You can regenerate it if you have applied changes.
Generate Prisma Client
yarn prisma:gen
This generates the Prisma client in ./generated/.prisma/client
Copy Prisma Client to Modules
yarn postinstall
This runs scripts/copy-prisma-client.js which copies the generated Prisma client into node_modules/@rs-tech-hub/nestjs-prisma/src/lib/generated/client
Important: Run this command after every yarn install or npm install to ensure modules have access to the Prisma client.
Run Database Migrations
yarn prisma:migrate:dev
This initializes the database schema with all required tables:
RefreshToken- For JWT refresh token rotationActivationToken- For email verificationUser- Core user dataProfile- User profile informationUserActivity- Activity trackingAccount- Account management
Step 6: Start the Server
Development Mode (with hot reload)
yarn start:dev
Production Mode
yarn build
yarn start
Your server will start on http://localhost:4000
Testing Your Setup
GraphQL Playground
Open your browser and navigate to:
http://localhost:4000/graphql
The GraphQL Playground provides an interactive interface where you can:
- Browse the complete API schema
- Run queries and mutations
- Test authentication flows
Example Queries
Try these queries in the playground:
Sign Up a New User
Note: Add the service token to your request headers:
{
"Authorization": "Bearer YOUR_SERVICE_TOKEN_HERE"
}
mutation {
auth_signUp(
email: "user@example.com"
password: "SecurePassword123!"
firstName: "John"
lastName: "Doe"
) {
token
activationKey
refreshToken
user {
id
email
Status
Role
accountId
createdAt
updatedAt
}
}
}
Activate the user
mutation Auth_activateUser {
auth_activateUser(
input: {
email: "user@example.com"
activationKey: "activationKey-from-signup"
}
)
}
Log In
mutation {
auth_login(email: "user@example.com", password: "SecurePassword123!") {
token
refreshToken
user {
id
Status
Role
email
issuerId
accountId
createdAt
updatedAt
}
}
}
Get Current User (Requires Authentication)
query {
auth_currentUser {
id
email
firstName
lastName
status
role
}
}
Note: Add the access token to your request headers:
{
"Authorization": "Bearer YOUR_ACCESS_TOKEN_HERE"
}
What's Included
The demo backend comes pre-configured with these RS Tech Hub modules:
| Module | Purpose |
|---|---|
@rs-tech-hub/nestjs-account-starter | Account lifecycle management |
@rs-tech-hub/nestjs-auth-core | JWT authentication foundation |
@rs-tech-hub/nestjs-auth-starter | Complete auth flow (signup, login, refresh) |
@rs-tech-hub/nestjs-clock | Timestamp and scheduling utilities |
@rs-tech-hub/nestjs-common-interceptors | Request/response interceptors |
@rs-tech-hub/nestjs-prisma | Prisma ORM integration |
@rs-tech-hub/nestjs-profile | User profile management |
@rs-tech-hub/nestjs-service-operation | Service layer patterns |
@rs-tech-hub/nestjs-user | User CRUD operations |
@rs-tech-hub/nestjs-test-starter | Testing utilities |
Available GraphQL Operations
Queries
auth_verifyEmail- Verify email addressauth_currentUser- Get authenticated useraccount_getById- Fetch account by IDaccount_validateData- Validate account datauser_getCurrent- Get current user detailsuser_getById- Fetch user by IDuser_getByEmail- Fetch user by emailprofile_get- Get user profilelicense_getLicenses- View license information
Mutations
auth_signUp- Register new userauth_login- Authenticate userauth_refreshToken- Refresh access tokenauth_logout- End sessionauth_renewActivationToken- Resend activation emailauth_activateUser- Activate user accountauth_confirmSignupEmail- Confirm email addressauth_updatePassword- Change passwordaccount_update- Update account detailsaccount_remove- Delete accountprofile_update- Update user profiletest_signUpTestUsers- Create test users (dev only)test_removeTestUsers- Remove test users (dev only)license_resetProductionUsageCount- Reset license usage
Project Structure
rs-tech-hub-demo-backend/
├── src/
│ ├── app/
│ │ ├── app.module.ts # Root module with all imports
│ │ └── app.service.ts # Application service
│ └── main.ts # Application entry point
├── prisma/
│ ├── starter-schema.prisma # Database schema
│ └── migrations/ # Database migrations
├── generated/
│ └── .prisma/client/ # Generated Prisma client
├── scripts/
│ └── copy-prisma-client.js # Prisma client copy script
├── .env # Environment variables
├── docker-compose.yml # Database container config
└── package.json # Dependencies and scripts
Next Steps
Now that you have the demo running, you can:
- Explore the modules - Check the NPM packages at @rs-tech-hub
- Customize your schema - Edit
prisma/starter-schema.prismaand run migrations - Add business logic - Build your domain logic on top of the infrastructure
- Integrate into your app - Use these modules in your own NestJS project
- Extend existing class - Build on top of RS-Tech-Hub service classes by extending them
- Get a license - Visit Gumroad to license for production
Troubleshooting
Port Already in Use
If port 4000 is taken, edit src/main.ts:
const port = process.env.PORT ?? 4000; // Change 4000 to your desired port
Docker Database Issues
Restart the Docker container:
docker-compose down
yarn docker:build:dev
Prisma Client Not Found
Make sure to run the postinstall script:
yarn postinstall
Missing Dependencies
Install all required packages manually:
yarn add graphql @apollo/server
yarn add @nestjs/common @nestjs/core reflect-metadata rxjs
yarn add @nestjs/platform-express
yarn add passport @nestjs/passport passport-jwt @nestjs/jwt passport-local bcrypt axios
yarn add @as-integrations/express5
Support & Resources
- Website: www.rs-tech-hub.com
- Email: insights@rs-tech-hub.com
- NPM: @rs-tech-hub
- GitHub: RuffSantiDev
- Licensing Gumroad
- Demo Repository: rs-tech-hub-demo-backend
What Makes This Different?
Unlike typical open-source packages or agency-built code:
✅ Professionally maintained - Security patches within 48 hours
✅ Monthly updates - Dependency updates included
✅ Breaking change notices - 90-day migration warnings
✅ Long-term commitment - No abandonware, guaranteed support
✅ Production-ready - Battle-tested patterns, not experimental code
You build features. We maintain infrastructure.
Ready to stop rebuilding authentication for the 10th time? Grab your license on Gumroad.
Support & Resources
- Website: www.rs-tech-hub.com
- Email: insights@rs-tech-hub.com
- NPM: @rs-tech-hub
- GitHub: RuffSantiDev
- Licensing Gumroad
- Demo Repository: rs-tech-hub-demo-backend