A NestJS-based REST API that provides endpoints to interact with Discord's API for fetching user profile data, avatars, and profile effects.
- User Profile Data: Fetch comprehensive Discord user profile information
- Avatar Retrieval: Download user avatars in high resolution (2048px)
- Profile Effects: Access user profile effects and decorations
- CORS Enabled: Ready for frontend integration
- TypeScript Support: Fully typed with custom DTOs
- Modern Architecture: Built with NestJS framework
- Node.js (v16 or higher)
- npm or yarn
- Acoount Token (for API access)
- Clone the repository:
git clone <repository-url>
cd discord-api-nest- Install dependencies:
npm install- Set up environment variables:
Create a
.envfile in the root directory and add your Discord token:
TOKEN=your_discord_bot_token_here
PORT=3000npm run start:devnpm run build
npm run start:prodnpm run start:debugThe application will start on http://localhost:3000 (or the port specified in your environment variables).
Returns a welcome message to verify the API is running.
Response:
{
"status": 200,
"message": "Hello π"
}Fetches comprehensive profile data for a Discord user.
Parameters:
id(string): Discord user ID
Response:
{
"user": {
"id": "123456789",
"username": "username",
"avatar": "avatar_hash",
"discriminator": "0001"
},
"connected_accounts": [],
"user_profile": {},
"badges": []
}Downloads the user's avatar image in high resolution.
Parameters:
id(string): Discord user ID
Response:
- Content-Type:
image/* - Returns the avatar image file (2048x2048 pixels)
Fetches user profile effects and decorations.
Parameters:
id(string): Discord user ID
Response:
{
"profile_effect": {}
}npm run testnpm run test:watchnpm run test:e2enpm run test:covsrc/
βββ app.controller.ts # Main application controller
βββ app.module.ts # Root application module
βββ main.ts # Application entry point
βββ discord/ # Discord API module
βββ discord.controller.ts # Discord endpoints controller
βββ discord.service.ts # Discord API service
βββ discord.module.ts # Discord module configuration
βββ dto/ # Data Transfer Objects
βββ userProfile.dto.ts # User profile interfaces
βββ profileEffects.dto.ts # Profile effects interfaces
The application uses the following environment variables:
TOKEN: Account token for API authenticationPORT: Port number for the application (default: 3000)
- Keep your Account token secure and never commit it to version control
- The application includes CORS support for frontend integration
- Proxy trust is enabled for deployment behind reverse proxies
- @nestjs/common: NestJS common utilities
- @nestjs/core: NestJS core framework
- @nestjs/axios: HTTP client module
- @nestjs/config: Configuration management
- axios: HTTP client for API requests
- rxjs: Reactive programming library
- @nestjs/testing: Testing utilities
- jest: Testing framework
- prettier: Code formatting
- eslint: Code linting
- typescript: TypeScript compiler
npm run buildnpm run start:prodnpm run formatnpm run lint- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the UNLICENSED license.
This project is for educational purposes. Make sure to comply with Discord's Terms of Service and API usage guidelines when using this application.