Notice: This project is very much still a work in progress
This project is a Stack Exchange clone built using Spring Boot with Kotlin. The application provides features such as user authentication, question and answer posting, voting, and more.
- User registration with username, email, and password
- Authentication using opaque bearer tokens and refresh tokens
- Question and answer posting
- Voting system
- Commenting on posts
- Email notifications for various events
- Planned Feature: OAuth2 user registration and authentication
- Java 21: Make sure you have JDK 21 installed on your machine.
- Gradle: Ensure Gradle is installed. The project uses the Gradle wrapper, so you can also use
./gradlew
. - Docker: Docker is required to run the application in development mode, as it uses Docker Compose for the database and other services.
- Mailtrap Account: A Mailtrap account is needed to handle email functionalities during development.
Create a .env
file in the root directory of the project. You can use the .env.example
file as a template.
MAIL_SERVER_USERNAME=example
MAIL_SERVER_PASSWORD=example
Replace example
with your actual Mailtrap credentials.
To run the application in local development mode, execute the following command:
./gradlew bootRun "-Dspring.profiles.active=local"
This command sets the active profile to local, which is configured to work with local development settings, including the usage of Docker Compose for setting up the database.
Users can register with the application using a username, email, and password. Upon successful registration, a verification email is sent to the user's email address to confirm their account.
The application uses opaque bearer tokens for authentication. Upon successful login, users receive an access token and a refresh token.
- Access Token: This token is used to authenticate and authorize the user for API requests. It has a limited lifespan for security purposes.
- Refresh Token: This token is used to obtain a new access token without re-authenticating. It has a longer lifespan and should be stored securely.
Users must include the bearer token in the Authorization header of their API requests:
Authorization: Bearer <access_token>
We plan to support OAuth2-based user registration and authentication in future releases. This feature will allow users to register and log in using their existing accounts from popular OAuth2 providers.
This project is licensed under the MIT License. See the LICENSE.txt
file for details.