A modern Stack Overflow-inspired question and answer platform built with Spring Boot and Next.js.
Browse and explore questions with filtering, sorting, and search functionality
Detailed question view with answers, comments, voting system, and user interactions
Intuitive question submission form with markdown support and tag selection
User profile dashboard with activity history, reputation, badges, and statistics
- Features
- Tech Stack
- Prerequisites
- Installation & Setup
- Running the Application
- API Documentation
- Project Structure
- Contributing
- License
- User Authentication & Authorization with JWT tokens
- Question Management - Ask, edit, and delete questions
- Answer System - Provide answers to questions
- Voting System - Upvote/downvote questions and answers
- Comments - Add comments to questions and answers
- Tagging System - Organize questions with tags
- User Profiles - View user statistics and activity
- Badge System - Earn badges for various achievements
- Search & Filter - Find questions by keywords and tags
- Real-time Updates - Modern UI with responsive design
- Markdown Support - Rich text formatting with LaTeX math support
- Java 21 - Programming language
- Spring Boot 3.5.0 - Application framework
- Spring Security - Authentication and authorization
- Spring Data JPA - Database access
- JWT - Token-based authentication
- PostgreSQL/CockroachDB - Database
- Lombok - Reduce boilerplate code
- OpenAPI/Swagger - API documentation
- Next.js 15 - React framework
- TypeScript - Type-safe JavaScript
- Tailwind CSS - Styling
- React Hook Form - Form handling
- Axios - HTTP client
- Radix UI - Accessible components
- React Markdown - Markdown rendering
- Lucide React - Icons
Before running this project, make sure you have the following installed:
- Java 21 or higher
- Node.js 18 or higher
- npm or yarn
- PostgreSQL or CockroachDB
- Git
git clone <repository-url>
cd sage
- Install PostgreSQL
- Create a database named
sage_db
- Update database credentials in
src/main/resources/application.properties
- Install CockroachDB
- Start CockroachDB:
cockroach start-single-node --insecure --listen-addr=localhost:26257
- Create database:
cockroach sql --insecure -e "CREATE DATABASE sage_db;"
- Navigate to the root directory
- Build the project:
./gradlew build
-
Navigate to the frontend directory:
cd frontend
-
Install dependencies:
npm install
From the root directory:
./gradlew bootRun
The backend will start on http://localhost:8080
From the frontend
directory:
npm run dev
The frontend will start on http://localhost:3000
./gradlew bootJar
java -jar build/libs/sage-0.0.1-SNAPSHOT.jar
cd frontend
npm run build
npm start
Once the backend is running, you can access the API documentation at:
- Swagger UI:
http://localhost:8080/swagger-ui/index.html
- OpenAPI JSON:
http://localhost:8080/v3/api-docs
sage/
βββ src/main/java/com/devik/sage/ # Backend source code
β βββ controller/ # REST controllers
β βββ model/ # JPA entities
β βββ service/ # Business logic
β βββ security/ # Security configuration
β βββ exception/ # Exception handling
βββ src/main/resources/
β βββ application.properties # Backend configuration
β βββ data.sql # Initial data
βββ frontend/ # Next.js frontend
β βββ src/app/ # App router pages
β βββ src/components/ # React components
β βββ src/lib/ # Utility functions
β βββ public/ # Static assets
βββ build.gradle.kts # Backend dependencies
βββ README.md # This file
Edit src/main/resources/application.properties
:
# Database Configuration
spring.datasource.url=jdbc:postgresql://localhost:26257/sage_db?sslmode=disable
spring.datasource.username=root
spring.datasource.password=
# JWT Configuration
jwt.secret=your-secret-key-here
jwt.expiration=86400000
Create a .env.local
file in the frontend
directory:
NEXT_PUBLIC_API_URL=http://localhost:8080
./gradlew test
cd frontend
npm run test
FROM openjdk:21-jdk
COPY build/libs/sage-0.0.1-SNAPSHOT.jar app.jar
EXPOSE 8080
ENTRYPOINT ["java", "-jar", "/app.jar"]
FROM node:18-alpine
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build
EXPOSE 3000
CMD ["npm", "start"]
- 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 MIT License - see the LICENSE file for details.
- Inspired by Stack Overflow's design and functionality
- Built with modern web technologies and best practices
- Community-driven development approach
Happy Coding! π
For any questions or issues, please open an issue in the repository or contact the maintainers.