This is a backend API for the Nexus application, built with ASP.NET Core (.NET 8). It provides authentication (including OTP-based password reset), payment processing (via Stripe), user management, and real-time features using SignalR.
- JWT Authentication: Secure login and registration with JWT tokens.
- User Management: Signup, signin, profile management, and password reset via email OTP.
- Password Reset via OTP: Users can request a 6-digit OTP to their email and reset their password securely.
- Payment Integration: Stripe-based payment method management and payment processing.
- Real-time Communication: SignalR hub for leaderboard updates.
- Swagger UI: Interactive API documentation and testing.
- Custom Middleware: For authentication and request handling.
- Logging: Console logging for diagnostics.
├── auth/
│ ├── Controllers/ # API controllers (e.g., PaymentController)
│ ├── Models/ # Data models (e.g., User, PaymentMethod, AuthModels)
│ ├── Services/ # Business logic (e.g., PaymentService)
│ ├── Hubs/ # SignalR hubs (e.g., LeaderboardHub)
│ └── Middlewares/ # Custom middleware (e.g., AuthMiddleware)
├── myapp/
│ ├── Data/ # Entity Framework DbContext and migrations
│ ├── DataAccess/ # Data access logic (e.g., UserDataAccess)
│ └── Services/ # Additional services (e.g., TokenService)
├── appsettings.json # Configuration (connection strings, JWT, Stripe)
├── Program.cs # Application entry point and DI setup
└── README.md # Project documentation
-
Prerequisites
- .NET 8 SDK
- SQL Server (local or remote)
- Stripe account (for payment integration) -SMTP provider (for email/OTP)
-
Configuration
- Update
appsettings.jsonwith your database connection string, JWT settings, Stripe secret key, and SMTP settings.
- Update
-
Database
- Ensure the
Your Project DBdatabase exists and is accessible. - Run EF Core migrations if needed.
- Ensure the
-
Run the Application
dotnet run
The API will be available at http://localhost:8080 (or as configured).
- API Documentation
- Open http://localhost:8080 in your browser for Swagger UI.
| Method | Route | Description | Auth Required |
|---|---|---|---|
| POST | /api/auth/signup |
Register a new user | No |
| POST | /api/auth/signin |
User login, returns JWT | No |
| POST | /api/auth/forgot-password |
Request a 6-digit OTP for password reset | No |
| POST | /api/auth/verify-otp |
Verify OTP sent to email | No |
| POST | /api/auth/reset-password |
Reset password using OTP | No |
| POST | /api/payment/add |
Add a payment method (Stripe) | Yes |
| GET | /api/payment (example) |
List payment methods (if exists) | Yes |
| GET | /leaderboardHub |
Real-time leaderboard updates (SignalR) | Yes |
Note: For a full list, see Swagger UI or the Controllers folder.
{
"Jwt": {
"Key": "...",
"Issuer": "...",
"Audience": "..."
},
"ConnectionStrings": {
"DefaultConnection": "Server=...;Database=...;User Id=...;Password=...;" },
"Stripe": { "SecretKey": "sk_test_..."
},
"Smtp": {
"Host": "smtp.example.com",
"Port": "587",
"User": "your_smtp_user",
"Pass": "your_smtp_password",
"From": "no-reply@example.com"
}
}
- Fork the repository.
- Create a feature branch.
- Commit your changes.
- Open a pull request.
This project is licensed under the MIT License.
Tip:
For a complete and up-to-date list of endpoints, always refer to the Swagger UI generated by the application.