Skip to content

akib2012/ClubSphere_server_side

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

27 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

ClubSphere – Backend (Server Side) Backend API for ClubSphere, a full-stack MERN application for managing local clubs, memberships, events, and payments. This server handles authentication, role-based authorization, database operations, and Stripe payment processing.

πŸ“Œ Project Overview The backend of ClubSphere is built using Node.js, Express.js, and MongoDB, with secure authentication via Firebase Admin SDK and payment processing through Stripe API. It provides RESTful APIs to support role-based dashboards for Admins, Club Managers, and Members.

πŸš€ Key Features RESTful API architecture Firebase JWT-based authentication & authorization Role-based access control (Admin, Club Manager, Member) Secure Stripe payment integration (test mode) CRUD operations for clubs, events, and memberships Event registration & membership lifecycle handling Admin moderation system (approve/reject clubs) Centralized payment tracking Production-ready CORS configuration

πŸ›  Technology Stack Node.js Express.js MongoDB Firebase Admin SDK (JWT verification) Stripe API CORS dotenv

πŸ“‚ Project Structure server/ β”œβ”€β”€ index.js β”œβ”€β”€ routes/ β”‚ β”œβ”€β”€ users.routes.js β”‚ β”œβ”€β”€ clubs.routes.js β”‚ β”œβ”€β”€ events.routes.js β”‚ β”œβ”€β”€ memberships.routes.js β”‚ β”œβ”€β”€ payments.routes.js β”‚ └── admin.routes.js β”œβ”€β”€ middleware/ β”‚ β”œβ”€β”€ verifyJWT.js β”‚ β”œβ”€β”€ verifyAdmin.js β”‚ └── verifyClubManager.js β”œβ”€β”€ config/ β”‚ β”œβ”€β”€ firebase.config.js β”‚ └── stripe.config.js β”œβ”€β”€ utils/ β”‚ └── generateToken.js └── .env

πŸ—„ Database Collections users name email photoURL role (admin | clubManager | member) createdAt clubs clubName description category location bannerImage membershipFee status (pending | approved | rejected) managerEmail (FK β†’ users) createdAt, updatedAt memberships userEmail clubId status (active | expired | pendingPayment) paymentId joinedAt expiresAt (optional) events clubId title description eventDate location isPaid eventFee maxAttendees (optional) createdAt eventRegistrations eventId userEmail clubId status (registered | cancelled) paymentId (optional) registeredAt payments userEmail amount type (membership | event) clubId eventId (optional) stripePaymentIntentId / transactionId status createdAt

πŸ” Authentication & Authorization Firebase Authentication (handled on client) Firebase Admin SDK verifies JWT on server Protected routes using middleware: verifyJWT verifyAdmin verifyClubManager

πŸ’³ Stripe Payment Flow Client requests payment intent Server creates Stripe PaymentIntent Stripe returns clientSecret Client confirms payment Server stores payment & updates membership/event status

βš™οΈ Environment Variables Create a .env file in the server directory: PORT=3000 MONGODB_URI=your_mongodb_connection_string STRIPE_SECRET_KEY=your_stripe_secret_key FIREBASE_PROJECT_ID=your_project_id FIREBASE_CLIENT_EMAIL=your_client_email FIREBASE_PRIVATE_KEY=your_private_key

πŸ“¦ Installation & Setup cd server npm install

β–Ά Run the Server npm run dev The server will run on: http://localhost:3000

πŸ§ͺ Testing Accounts (Client Side) Admin Email: admin100@gmail.com Password: Admin@1234 Club Manager Email: manager100@gmail.com Password: Manager@11234

πŸ“š Important NPM Packages express cors mongodb firebase-admin stripe dotenv

Developed by: MD Perbej Bhuiyan Akib

About

Backend REST API for ClubSphere built with Node.js, Express, and MongoDB, featuring Firebase JWT authentication, role-based access control, and Stripe payment integration.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors