Skip to content

Sage is a full-stack Q&A platform built with Spring Boot (Java/Kotlin), Next.js (TypeScript/React) and Gradle. It offers question management, tagging, user profiles and a responsive, client-side navigation.

License

Notifications You must be signed in to change notification settings

deviknitkkr/Sage

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

14 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Sage - Q&A Platform

A modern Stack Overflow-inspired question and answer platform built with Spring Boot and Next.js.

πŸ“Έ Screenshots

Questions Page

Questions Page

Browse and explore questions with filtering, sorting, and search functionality

Question & Answer Page

Question Answer Page

Detailed question view with answers, comments, voting system, and user interactions

Ask Question Page

Ask Question Page

Intuitive question submission form with markdown support and tag selection

User Profile Page

Profile Page

User profile dashboard with activity history, reputation, badges, and statistics

Table of Contents

Features

  • 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

Tech Stack

Backend

  • 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

Frontend

  • 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

Prerequisites

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

πŸš€ Installation & Setup

1. Clone the Repository

git clone <repository-url>
cd sage

2. Database Setup

Option A: PostgreSQL

  1. Install PostgreSQL
  2. Create a database named sage_db
  3. Update database credentials in src/main/resources/application.properties

Option B: CockroachDB (Recommended)

  1. Install CockroachDB
  2. Start CockroachDB:
    cockroach start-single-node --insecure --listen-addr=localhost:26257
  3. Create database:
    cockroach sql --insecure -e "CREATE DATABASE sage_db;"

3. Backend Setup

  1. Navigate to the root directory
  2. Build the project:
    ./gradlew build

4. Frontend Setup

  1. Navigate to the frontend directory:

    cd frontend
  2. Install dependencies:

    npm install

πŸƒβ€β™‚οΈ Running the Application

Start the Backend Server

From the root directory:

./gradlew bootRun

The backend will start on http://localhost:8080

Start the Frontend Development Server

From the frontend directory:

npm run dev

The frontend will start on http://localhost:3000

Production Build

Backend

./gradlew bootJar
java -jar build/libs/sage-0.0.1-SNAPSHOT.jar

Frontend

cd frontend
npm run build
npm start

πŸ“š API Documentation

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

πŸ“ Project Structure

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

πŸ”§ Configuration

Backend Configuration

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

Frontend Configuration

Create a .env.local file in the frontend directory:

NEXT_PUBLIC_API_URL=http://localhost:8080

Testing

Backend Tests

./gradlew test

Frontend Tests

cd frontend
npm run test

🐳 Docker Support

Backend Dockerfile

FROM openjdk:21-jdk
COPY build/libs/sage-0.0.1-SNAPSHOT.jar app.jar
EXPOSE 8080
ENTRYPOINT ["java", "-jar", "/app.jar"]

Frontend Dockerfile

FROM node:18-alpine
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build
EXPOSE 3000
CMD ["npm", "start"]

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

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

About

Sage is a full-stack Q&A platform built with Spring Boot (Java/Kotlin), Next.js (TypeScript/React) and Gradle. It offers question management, tagging, user profiles and a responsive, client-side navigation.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published