Hey there, thanks for deciding to contribute to Perplexica. Anything you help with will support the development of Perplexica and will make it better! This guide will help you get started with contributing to our project.
- Prerequisites
- Project Structure
- Setting Up Your Environment
- Development Workflow
- Coding and Contribution Practices
- Making Contributions
- Coding Standards
- Reporting Issues
- Help and Support
Before you begin, ensure you have the following installed:
- Git
- Node.js (version specified in the project's package.json)
- npm or yarn
- Docker and Docker Compose (if using the Docker setup)
Perplexica's design consists of two main domains:
- Frontend (
ui
directory): This is a Next.js application holding all user interface components. It's a self-contained environment that manages everything the user interacts with. - Backend (root and
src
directory): The backend logic is situated in thesrc
folder, but the root directory holds the mainpackage.json
for backend dependency management.
Before diving into coding, setting up your local environment is key. You have two options: using Docker (recommended) or setting up without Docker.
This method provides a consistent development environment with hot reloading.
-
Ensure Docker and Docker Compose are installed on your system.
-
Fork the repository on GitHub.
-
Clone your forked repository:
git clone https://github.com/your-username/perplexica.git cd perplexica
-
Copy the sample configuration files:
cp sample.config.toml config.toml cp ui/.env.example ui/.env
-
Edit
config.toml
andui/.env
to add necessary configuration values. -
Build and start the development environment:
docker-compose -f docker-compose.dev.yaml up --build
The services will be available at:
- Frontend: http://localhost:3000
- Backend: http://localhost:3001
This setup includes hot reloading:
- Frontend code changes (in
ui
directory) are immediately reflected in the browser. - Backend code changes (in
src
directory) automatically restart the backend service. - Changes to
package.json
in either root orui
directory trigger an automatic rebuild.
- In the root directory, locate the
sample.config.toml
file. - Rename it to
config.toml
and fill in the necessary configuration fields specific to the backend. - Run
npm install
to install dependencies. - Use
npm run dev
to start the backend in development mode.
- Navigate to the
ui
folder and repeat the process of renaming.env.example
to.env
, making sure to provide the frontend-specific variables. - Execute
npm install
within theui
directory to get the frontend dependencies ready. - Launch the frontend development server with
npm run dev
.
Please note: While Docker configurations are present for setting up production environments, npm run dev
is used for development purposes in the non-Docker setup.
-
Create a new branch for your feature or bug fix:
git checkout -b feature/your-feature-name
-
Make your changes in the appropriate directories (
src
for backend,ui
for frontend). -
Test your changes thoroughly.
-
Run the formatter:
npm run format:write
-
Commit your changes with a descriptive commit message:
git commit -am "Add your commit message here"
-
Push your branch to GitHub:
git push origin feature/your-feature-name
-
Open a pull request on GitHub, describing your changes in detail.
Before committing changes:
- Ensure that your code functions correctly by thorough testing.
- Always run
npm run format:write
to format your code according to the project's coding standards. This helps maintain consistency and code quality. - Write clear, concise commit messages that explain the purpose of your changes.
- Keep your pull requests focused on a single feature or bug fix.
- Update documentation, including README.md and inline comments, if your changes affect the project's usage or setup.
We currently do not have a formal code of conduct, but it is in the works. In the meantime, please be mindful of how you engage with the project and its community. We expect all contributors to be respectful, inclusive, and professional in their interactions.
- Fork the repository and create your branch from
main
. - If you've added code that should be tested, add tests.
- Issue that pull request!
- Follow the existing code style and structure.
- Write clear, commented code. Use JSDoc comments for functions and classes.
- Write clear, commented code.
- Ensure type safety by using TypeScript effectively.
- Write unit tests for new features when applicable.
If you find a bug or have a suggestion for improvement:
- Check if the issue already exists in the GitHub issue tracker.
- If not, create a new issue, providing as much detail as possible, including:
- A clear and descriptive title
- Steps to reproduce the issue
- Expected behavior
- Actual behavior
- Your environment (OS, browser, version, etc.)
- Any relevant screenshots or error messages
If you have any questions or feedback, please feel free to reach out to us. You can:
- Create an issue on GitHub for project-related questions.
We appreciate your contributions and look forward to your involvement in making Perplexica even better!