A full-stack social media application built with ASP.NET Core Web API and React, featuring user management, posts, comments, followers, and comprehensive statistics with network visualization.
- User Management: Complete CRUD operations for user accounts with authentication
- Posts & Comments: Create, read, update, and delete posts with nested commenting system
- Follower System: Follow/unfollow users with relationship tracking
- Authentication: JWT-based authentication with secure password hashing (BCrypt)
- Statistics Dashboard: Interactive charts and network graphs showing user engagement
- Image Management: User profile image upload and management
- Pagination: Efficient data loading with search and filtering capabilities
- Network Graph Visualization: Interactive network showing user relationships
- Statistics Charts: Highcharts integration for data visualization
- Cyclic Data Generation: Special controller for generating test data patterns
- Real-time Updates: Dynamic content loading with infinite scroll
- Responsive Design: Mobile-first approach with Tailwind CSS
- WYSIWYG Editor: Rich text editing for posts and comments
- Framework: ASP.NET Core Web API 8.0
- Database: SQL Server with Entity Framework Core 9.0.2
- Authentication: JWT Bearer tokens with custom security implementation
- API Documentation: Swagger/OpenAPI 3.0 with comprehensive documentation
- Data Mapping: AutoMapper for DTO transformations
- Password Security: BCrypt.Net for secure password hashing
- CORS: Configured for cross-origin requests
- Framework: React 18.3.1 with Vite build tool
- Routing: React Router DOM 6.30.0
- Styling: Tailwind CSS 4.0.11 with custom components
- HTTP Client: Axios with interceptors for authentication
- Charts: Highcharts React for data visualization
- Text Editor: React Draft WYSIWYG for rich content creation
- UI Components: Headless UI with Heroicons
- Utilities: Moment.js for date handling, React CountUp for animations
Users
├── ID (Primary Key)
├── Username
├── Password (BCrypt hashed)
├── Email
├── FirstName, LastName
├── BirthDate
├── CreatedAt
└── Image (Profile picture)
Posts
├── ID (Primary Key)
├── UserID (Foreign Key → Users)
├── Content (Rich text)
├── Likes
├── CreatedAt
└── Comments (One-to-Many)
Comments
├── ID (Primary Key)
├── UserID (Foreign Key → Users)
├── PostID (Foreign Key → Posts)
├── Content
├── Likes
└── CreatedAt
Followers
├── ID (Primary Key)
├── UserID (Foreign Key → Users) - Being followed
├── FollowerUserID (Foreign Key → Users) - Following
└── FollowedAt
Operators
├── ID (Primary Key)
├── UserID (Foreign Key → Users)
├── Email
└── Password (System administrators)POST /api/v1/Authorization/token- Generate JWT token
GET /api/v1/User- Get all usersGET /api/v1/User/{id}- Get user by IDPOST /api/v1/User- Create new user (public)PUT /api/v1/User/{id}- Update userDELETE /api/v1/User/{id}- Delete userGET /api/v1/User/pagination/{page}- Paginated users with searchPOST /api/v1/User/{id}/setImage- Upload profile imageGET /api/v1/User/generate/{amount}- Generate test users
GET /api/v1/Post- Get all posts with commentsGET /api/v1/Post/{id}- Get specific postPOST /api/v1/Post- Create new postPUT /api/v1/Post/{id}- Update postDELETE /api/v1/Post/{id}- Delete postGET /api/v1/Post/pagination/{page}- Paginated posts with searchGET /api/v1/Post/generate/{amount}- Generate test posts
GET /api/v1/Comment- Get all commentsGET /api/v1/Comment/{id}- Get specific commentPOST /api/v1/Comment- Create new commentPUT /api/v1/Comment/{id}- Update commentDELETE /api/v1/Comment/{id}- Delete commentGET /api/v1/Comment/pagination/{page}- Paginated comments
GET /api/v1/Follower- Get all follower relationshipsPOST /api/v1/Follower- Create follow relationshipDELETE /api/v1/Follower/{id}- Unfollow userGET /api/v1/Follower/followStatuses- Check follow statusGET /api/v1/Follower/pagination/{page}- Paginated followers
GET /api/v1/Statistics/totalData- Get total countsGET /api/v1/Statistics/topUserStats- Get top user statisticsGET /api/v1/Statistics/randomUsers- Get random user dataGET /api/v1/Statistics/pagination/{page}- Paginated statistics
- .NET 8.0 SDK
- Node.js 18+ and npm/bun
- SQL Server (LocalDB or full instance)
- Visual Studio 2022 or VS Code
-
Clone the repository
git clone https://github.com/Sacobrt/SocialMediaAPP.git cd SocialMediaAPP/Backend -
Configure Database
- Update
appsettings.jsonwith your SQL Server connection string - Run the database creation script:
socialMedia.sql
- Update
-
Install Dependencies
dotnet restore
-
Run the Application
dotnet run
- API will be available at
https://localhost:7256 - Swagger documentation at
https://localhost:7256/swagger - Frontend will also start automatically and be available at
http://localhost:5173
- API will be available at
-
Navigate to Frontend Directory
cd SocialMediaAPP/Frontend -
Install Dependencies
# Using npm npm install # Using bun (recommended) bun install
-
Configure API URL
- Update
src/constants.jswith your backend URL if different
- Update
-
Run Development Server
# Using npm npm run dev # Using bun bun run dev
- Frontend will be available at
http://localhost:5173
- Frontend will be available at
# Frontend
bun run build
# This automatically moves built files to Backend/wwwroot
# Backend serves both API and frontend in production- Token Generation: 8-hour expiration with secure HMAC SHA256 signing
- Claims: UserID, Username, Email, FirstName, LastName, Image
- Security: BCrypt password hashing with salt rounds
- Public Endpoints: User registration, token generation
- Authenticated Endpoints: All CRUD operations require valid JWT
- Operator System: Special admin accounts for system management
- Configured for development and production environments
- Allows all origins, methods, and headers in development
- Restrictive settings recommended for production
- Total Counts: Users, Posts, Comments with animated counters
- Most Liked Content: Interactive column charts
- User Activity: Recent user registrations timeline
- Network Graph: Interactive visualization of user relationships
- Top Users: Statistics on most active users
- Highcharts Integration: Professional charting library
- Interactive Elements: Hover effects, clickable data points
- Responsive Design: Charts adapt to screen size
- Real-time Updates: Data refreshes automatically
- Configurable Page Sizes: Default 20 items per page
- Search Filtering: Full-text search across relevant fields
- Sorting Options: Multiple sort criteria support
- Performance Optimized: Efficient database queries with Entity Framework
- Faker.Net Integration: Realistic test data generation
- Bulk Operations: Generate hundreds of users, posts, comments
- Relationship Maintenance: Proper foreign key relationships
- Development Support: Quick setup for testing and development
src/
├── components/ # Reusable UI components
│ ├── AuthContext.jsx # Authentication context
│ ├── NavBar.jsx # Navigation component
│ ├── NetworkGraph.jsx # D3.js network visualization
│ └── TotalData.jsx # Statistics display
├── hooks/ # Custom React hooks
│ ├── useAuth.js # Authentication management
│ ├── useError.js # Error handling
│ └── parseJwt.js # JWT token parsing
├── pages/ # Route components
│ ├── users/ # User management pages
│ ├── posts/ # Post management pages
│ ├── comments/ # Comment management pages
│ ├── followers/ # Follower management pages
│ └── Statistics.jsx # Analytics dashboard
└── services/ # API communication
├── HttpService.js # Axios configuration
├── AuthService.js # Authentication API
└── *Service.js # Entity-specific APIs
- React Context: Authentication and error state
- Local Storage: JWT token persistence
- Component State: UI-specific state management
- HTTP Interceptors: Automatic token attachment and error handling
- Backend:
https://localhost:7256 - Frontend:
http://localhost:5173 - Database: SQL Server LocalDB
- Static Files: Served from Backend wwwroot
- SPA Support: Fallback routing for client-side navigation
- HTTPS: Enforced for security
- Frontend builds to
dist/directory - Build script moves files to
Backend/wwwroot/ - Backend serves both API and static files
- Single deployment artifact
- Comprehensive Documentation: All endpoints documented with examples
- Authentication Support: JWT token testing interface
- Multiple Environments: Development and production server configurations
- Success Responses: Consistent JSON structure with data
- Error Responses: Standardized error messages with HTTP status codes
- Validation: Model state validation with detailed error messages
- Realistic Data: Faker.Net generates authentic-looking test data
- Bulk Operations: Generate thousands of records quickly
- Relationship Integrity: Maintains proper foreign key relationships
- Development Seeding: Pre-populated data for immediate testing
- Hot Reload: Both frontend and backend support hot reload
- API Explorer: Swagger UI for API testing
- Network Inspector: Browser dev tools for request monitoring
- Error Handling: Comprehensive error boundaries and logging
This project is licensed under the MIT License - suitable for educational and commercial use.
- GitHub: @sacobrt