This document centralizes API onboarding, interactive documentation, SDK generation, and example requests for the StrellerMinds Backend.
- A running StrellerMinds Backend instance. Follow
README.mdto install and start the API.
- Local development:
http://localhost:3000/api - All routes are prefixed with
/api(seesrc/main.ts).
- Swagger UI:
http://localhost:3000/api/docs - OpenAPI JSON:
http://localhost:3000/api/docs-json
Swagger UI is generated from the OpenAPI 3.0 specification produced by @nestjs/swagger. The title, description, version, tags, and bearer auth scheme are configured in src/main.ts.
The API uses JWT bearer tokens for access. Token issuance and rotation are handled through the auth endpoints:
POST /api/auth/registerPOST /api/auth/loginPOST /api/auth/refreshPOST /api/auth/logoutPOST /api/auth/logout-all
Use the access token in the Authorization header:
Authorization: Bearer <accessToken>
Note: JwtAuthGuard is registered as a global guard in src/app.module.ts, so requests are expected to include the Authorization header.
All endpoints return a standardized response wrapper from ResponseInterceptor:
{
"success": true,
"data": {},
"message": "Operation successful",
"timestamp": "2024-01-01T00:00:00.000Z",
"path": "/api/example",
"version": "1.0.0"
}version is derived from API_VERSION when set, otherwise defaults to 1.0.0.
GET /api/healthGET /api/health/readyGET /api/health/live
POST /api/auth/registerPOST /api/auth/loginPOST /api/auth/refreshPOST /api/auth/logoutPOST /api/auth/logout-allPOST /api/auth/forgot-passwordPOST /api/auth/reset-passwordPOST /api/auth/verify-emailPOST /api/auth/change-passwordGET /api/auth/profilePOST /api/auth/admin/users
POST /api/usersGET /api/usersGET /api/users/:idPATCH /api/users/:idPATCH /api/users/:id/profilePOST /api/users/:id/change-passwordPOST /api/users/:id/avatarPOST /api/users/:id/suspendPOST /api/users/:id/reactivateDELETE /api/users/:idPOST /api/users/bulk-updateGET /api/users/:id/exportGET /api/users/:id/activities
GET /api/profiles/meGET /api/profiles/me/fullPUT /api/profiles/meGET /api/profiles/:userId/profileGET /api/profiles/:profileIdGET /api/profiles/:profileId/analyticsPOST /api/profiles/me/portfolioGET /api/profiles/me/portfolioGET /api/profiles/:profileId/portfolioGET /api/profiles/portfolio/:itemIdPUT /api/profiles/portfolio/:itemIdDELETE /api/profiles/portfolio/:itemIdPOST /api/profiles/portfolio/reorderGET /api/profiles/portfolio/searchGET /api/profiles/me/badgesGET /api/profiles/:profileId/badgesGET /api/profiles/me/achievements/stats
POST /api/social/:userId/followPOST /api/social/:userId/unfollowGET /api/social/me/followersGET /api/social/me/followingGET /api/social/:userId/followersGET /api/social/:userId/followingGET /api/social/me/networkGET /api/social/me/suggestedGET /api/social/me/statsGET /api/social/:userId/statsPOST /api/social/:userId/blockPOST /api/social/:userId/unblockPOST /api/social/:userId/mutePOST /api/social/:userId/unmuteGET /api/social/:userId/mutual
GET /api/privacy/me/settingsPUT /api/privacy/me/settingsPOST /api/privacy/me/block/:userIdPOST /api/privacy/me/unblock/:userIdPOST /api/privacy/me/mute/:userIdPOST /api/privacy/me/unmute/:userIdPOST /api/privacy/me/exportGET /api/privacy/me/dataPOST /api/privacy/me/data/deleteGET /api/privacy/:userId/can-view
GET /api/achievements/badges/allGET /api/achievements/badges/:badgeIdPOST /api/achievements/me/awardGET /api/achievements/me/statsGET /api/achievements/:userId/statsGET /api/achievements/leaderboardGET /api/achievements/badges/search
POST /api/notifications/email/sendPOST /api/notifications/email/templatesPUT /api/notifications/email/templates/:idGET /api/notifications/email/templates/:idGET /api/notifications/email/templates/type/:typePOST /api/notifications/preferencesGET /api/notifications/preferences/:userIdPUT /api/notifications/preferences/:userIdPOST /api/notifications/unsubscribeGET /api/notifications/analytics/:emailQueueIdGET /api/notifications/analytics/user/:userIdGET /api/notifications/analytics/overall
POST /api/files/uploadPOST /api/files/upload-chunkPOST /api/files/complete-uploadGET /api/files/:idDELETE /api/files/:idPOST /api/files/:id/sharePUT /api/files/:id/public
The OpenAPI spec in Swagger UI provides the complete request and response schemas for each endpoint. The following schemas are defined directly in the codebase and are referenced by the API:
Auth endpoints return the auth user model defined in src/auth/entities/user.entity.ts with the password field removed, plus a computed fullName field.
Fields returned by UserResponseDto in src/user/dto/user.dto.ts:
idemailusernamefirstNamelastNamefullNameavatarphonebiodateOfBirthstatusrolespermissionsemailVerifiedlastLoginloginCounttwoFactorEnabledcreatedAtupdatedAt
Fields returned by UserProfileResponseDto in src/user/dto/profile.dto.ts:
iduserIdbioheadlineprofilePhotoUrlcoverPhotoUrllocationwebsiteskillsspecializationyearsOfExperienceeducationsocialLinksthemeshowBadgesshowPortfolioshowActivityfollowersCountfollowingCountportfolioItemsCountbadgesCountprofileViewsisVerifiedcompletionStatuscompletionPercentagecreatedAtupdatedAt
UserProfileWithDetailsDto extends UserProfileResponseDto with:
portfolioItemsbadgesanalytics
Fields returned by PortfolioItemResponseDto in src/user/dto/profile.dto.ts:
idprofileIdtitledescriptiontypecontentimageUrlprojectUrlrepositoryUrlcertificateUrltechnologiestagsstartDateendDateisFeaturedviewCountlikeCountisPublicdisplayOrdercreatedAtupdatedAt
Fields returned by ProfileAnalyticsResponseDto in src/user/dto/profile.dto.ts:
idprofileIdtotalViewsviewsTodayviewsThisWeekviewsThisMonthtotalFollowsGainedtotalFollowsLostportfolioItemsViewsportfolioItemsClicksbadgesDisplaystrafficSourcesdeviceTypestopCountriesaverageSessionDurationlastViewedAtrecentViewerscreatedAtupdatedAt
Fields returned by PrivacySettingsResponseDto in src/user/dto/privacy.dto.ts:
idprofileIdprofileVisibilityportfolioVisibilitybadgesVisibilityactivityVisibilityallowMessagingallowFollowingallowMentionsshowInSearchshowInRecommendationsshareActivityFeedshareAnalyticsallowThirdPartyIntegrationsemailNotificationspushNotificationsmarketingEmailsblockedUsersmutedUserscustomPrivacydataRetentionDaysautoDeleteInactivitycreatedAtupdatedAt
Fields returned by AchievementStatsDto in src/user/dto/achievement.dto.ts:
totalBadgesEarnedtotalBadgesAvailablebadgesByCategoryrareBadgesCountrecentBadgesnextBadgeProgress
Fields returned by SocialStatsDto in src/user/dto/social.dto.ts:
followersCountfollowingCountmutualConnectionsCountblockedCountmutedCount
Request body fields: email, password, optional deviceId.
curl -X POST http://localhost:3000/api/auth/login \
-H "Content-Type: application/json" \
-d '{
"email": "user@example.com",
"password": "Password123!",
"deviceId": "web-1"
}'const response = await fetch('http://localhost:3000/api/auth/login', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
email: 'user@example.com',
password: 'Password123!',
deviceId: 'web-1'
})
});
const data = await response.json();import requests
response = requests.post(
"http://localhost:3000/api/auth/login",
json={
"email": "user@example.com",
"password": "Password123!",
"deviceId": "web-1"
},
)
data = response.json()Request body fields align with UpdateUserProfileDto in src/user/dto/profile.dto.ts.
curl -X PUT http://localhost:3000/api/profiles/me \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <accessToken>" \
-d '{
"bio": "Passionate blockchain developer",
"headline": "Smart Contract Engineer",
"location": "San Francisco",
"skills": "Solidity, TypeScript, NestJS",
"specialization": "DeFi",
"yearsOfExperience": 5
}'const response = await fetch('http://localhost:3000/api/profiles/me', {
method: 'PUT',
headers: {
'Content-Type': 'application/json',
Authorization: 'Bearer <accessToken>'
},
body: JSON.stringify({
bio: 'Passionate blockchain developer',
headline: 'Smart Contract Engineer',
location: 'San Francisco',
skills: 'Solidity, TypeScript, NestJS',
specialization: 'DeFi',
yearsOfExperience: 5
})
});
const data = await response.json();import requests
response = requests.put(
"http://localhost:3000/api/profiles/me",
headers={"Authorization": "Bearer <accessToken>"},
json={
"bio": "Passionate blockchain developer",
"headline": "Smart Contract Engineer",
"location": "San Francisco",
"skills": "Solidity, TypeScript, NestJS",
"specialization": "DeFi",
"yearsOfExperience": 5
},
)
data = response.json()Request body fields align with CreatePortfolioItemDto in src/user/dto/profile.dto.ts.
curl -X POST http://localhost:3000/api/profiles/me/portfolio \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <accessToken>" \
-d '{
"title": "DeFi Lending Protocol",
"description": "Smart contracts for lending on Stellar",
"type": "project",
"projectUrl": "https://github.com/user/defi-protocol",
"technologies": ["Soroban", "Rust", "TypeScript"],
"tags": ["DeFi", "Stellar", "Smart Contracts"],
"startDate": "2023-01-01",
"endDate": "2023-06-30"
}'const response = await fetch('http://localhost:3000/api/profiles/me/portfolio', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Authorization: 'Bearer <accessToken>'
},
body: JSON.stringify({
title: 'DeFi Lending Protocol',
description: 'Smart contracts for lending on Stellar',
type: 'project',
projectUrl: 'https://github.com/user/defi-protocol',
technologies: ['Soroban', 'Rust', 'TypeScript'],
tags: ['DeFi', 'Stellar', 'Smart Contracts'],
startDate: '2023-01-01',
endDate: '2023-06-30'
})
});
const data = await response.json();import requests
response = requests.post(
"http://localhost:3000/api/profiles/me/portfolio",
headers={"Authorization": "Bearer <accessToken>"},
json={
"title": "DeFi Lending Protocol",
"description": "Smart contracts for lending on Stellar",
"type": "project",
"projectUrl": "https://github.com/user/defi-protocol",
"technologies": ["Soroban", "Rust", "TypeScript"],
"tags": ["DeFi", "Stellar", "Smart Contracts"],
"startDate": "2023-01-01",
"endDate": "2023-06-30"
},
)
data = response.json()The OpenAPI spec powers SDK generation. Generate SDKs from the live spec:
curl -o openapi.json http://localhost:3000/api/docs-jsonTypeScript (fetch):
npx @openapitools/openapi-generator-cli generate \
-i openapi.json \
-g typescript-fetch \
-o sdk/typescriptPython:
npx @openapitools/openapi-generator-cli generate \
-i openapi.json \
-g python \
-o sdk/pythonJava:
npx @openapitools/openapi-generator-cli generate \
-i openapi.json \
-g java \
-o sdk/java- Auth endpoints use NestJS Throttler via
ThrottlerGuardinsrc/auth/controllers/auth.controller.ts.- Current module configuration: 10 requests per minute and 100 requests per hour (
src/auth/auth.module.ts).
- Current module configuration: 10 requests per minute and 100 requests per hour (
- Profile analytics are available via
GET /api/profiles/:profileId/analytics. - Email analytics are available via:
GET /api/notifications/analytics/:emailQueueIdGET /api/notifications/analytics/user/:userIdGET /api/notifications/analytics/overall
- Use Swagger UI (
/api/docs) as the interactive developer dashboard for exploring and testing endpoints. - Report issues or request support via the GitHub issue tracker: https://github.com/StarkMindsHQ/StrellerMinds-Backend/issues
- API version is reported in the response envelope (
versionfield). - OpenAPI spec version is set to
1.0.0insrc/main.ts.
- Baseline OpenAPI 3.0 spec exposed at
/api/docs-json.