Skip to content
CS-NexusPublic

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Nexus Backend (.NET 8)

Overview

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.


Features

  • 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.

Folder Structure

├── 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

How to Run

  1. Prerequisites

    • .NET 8 SDK
    • SQL Server (local or remote)
    • Stripe account (for payment integration) -SMTP provider (for email/OTP)
  2. Configuration

    • Update appsettings.json with your database connection string, JWT settings, Stripe secret key, and SMTP settings.
  3. Database

    • Ensure the Your Project DB database exists and is accessible.
    • Run EF Core migrations if needed.
  4. Run the Application

    dotnet run
    

The API will be available at http://localhost:8080 (or as configured).

  1. API Documentation

API Endpoints

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.


Configuration Example (appsettings.json)

{ 
	"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" 
	} 
}

Contributing

  1. Fork the repository.
  2. Create a feature branch.
  3. Commit your changes.
  4. Open a pull request.

License

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.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages