|
| 1 | +# Contributing to Hacktoberfest Projects Finder |
| 2 | + |
| 3 | +Thank you for your interest in contributing to the Hacktoberfest Projects Finder! We welcome contributions from everyone. This document will guide you through the process of setting up the project locally and creating a GitHub OAuth application. |
| 4 | + |
| 5 | +## Setting Up the Project |
| 6 | + |
| 7 | +1. Fork the repository on GitHub. |
| 8 | +2. Clone your forked repository: |
| 9 | +```sh |
| 10 | +git clone https://github.com/your-username/hacktoberfest-projects.git |
| 11 | +``` |
| 12 | +3. Navigate to the project directory: |
| 13 | +```sh |
| 14 | +cd hacktoberfest-projects |
| 15 | +``` |
| 16 | +4. Install dependencies (we recommend using `pnpm`): |
| 17 | +```sh |
| 18 | +pnpm install |
| 19 | +``` |
| 20 | +5. Copy the `.env.example` file to `.env.local` and fill in the required environment variables. |
| 21 | + |
| 22 | +## Creating a GitHub OAuth Application |
| 23 | + |
| 24 | +To use GitHub authentication in the project, you need to create a GitHub OAuth application. Follow these steps: |
| 25 | + |
| 26 | +1. Go to your GitHub account settings. |
| 27 | +2. Navigate to "Developer settings" > "OAuth Apps". |
| 28 | +3. Click on "New OAuth App". |
| 29 | +4. Fill in the application details: |
| 30 | +- Application name: "Hacktoberfest Projects Finder" (or your preferred name) |
| 31 | +- Homepage URL: `http://localhost:3000` (for local development) |
| 32 | +- Authorization callback URL: `http://localhost:3000/api/auth/callback/github` |
| 33 | +5. Click "Register application". |
| 34 | +6. On the next page, you'll see your Client ID. Click "Generate a new client secret" to create your Client Secret. |
| 35 | +7. Copy the Client ID and Client Secret to your `.env.local` file. |
| 36 | + |
| 37 | +## Setting Up Xata |
| 38 | + |
| 39 | +Xata is used as the database for this project. Follow these steps to set it up: |
| 40 | + |
| 41 | +1. Sign up for a Xata account at https://xata.io/ |
| 42 | +2. Install the Xata CLI globally: |
| 43 | +```sh |
| 44 | +npm install -g "@xata.io/cli@latest" |
| 45 | +``` |
| 46 | +3. Authenticate with Xata: |
| 47 | +```sh |
| 48 | +xata auth login |
| 49 | +``` |
| 50 | +4. Update the database settings in `xata.ts` and `.xatarc` files (do not commit these changes). |
| 51 | +5. Run the migration: |
| 52 | +```sh |
| 53 | +xata push main |
| 54 | +``` |
| 55 | + |
| 56 | +## Environment Variables |
| 57 | + |
| 58 | +Create a `.env.local` file in the root of the project and add the following variables: |
| 59 | +```sh |
| 60 | +AUTH_SECRET="" # A random string |
| 61 | +AUTH_URL="" # Should be http://localhost:3000 for local development |
| 62 | +AUTH_GITHUB_ID="" |
| 63 | +AUTH_GITHUB_SECRET="" |
| 64 | +XATA_API_KEY="" |
| 65 | +XATA_BRANCH="" # Default should be "main" |
| 66 | + |
| 67 | +NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME="" # Optional |
| 68 | +NEXT_PUBLIC_ANALYTICS_WEBSITE_ID="" # Optional |
| 69 | +``` |
| 70 | + |
| 71 | +Make sure to fill in the required values for each variable. The `AUTH_SECRET` should be a random string, and `AUTH_URL` should be set to `http://localhost:3000` for local development. The `XATA_BRANCH` should typically be set to "main" unless you're using a different branch. Remember that the `NEXT_PUBLIC_` variables are optional. |
| 72 | + |
| 73 | +## Running the Project |
| 74 | + |
| 75 | +After setting up the environment variables, you can start the development server: |
| 76 | +```sh |
| 77 | +pnpm dev |
| 78 | +``` |
| 79 | + |
| 80 | +The application should now be running at `http://localhost:3000`. |
| 81 | + |
| 82 | +## Making Contributions |
| 83 | + |
| 84 | +1. Create a new branch for your feature or bug fix: |
| 85 | +```sh |
| 86 | +git checkout -b feature/your-feature-name |
| 87 | +``` |
| 88 | +2. Make your changes and commit them with a descriptive commit message. |
| 89 | +3. Push your changes to your fork: |
| 90 | +```sh |
| 91 | +git push origin feature/your-feature-name |
| 92 | +``` |
| 93 | +4. Create a pull request from your fork to the main repository. |
| 94 | + |
| 95 | +Please ensure your code follows the project's coding standards and includes appropriate tests if applicable. |
| 96 | + |
| 97 | +## Questions or Issues |
| 98 | + |
| 99 | +If you have any questions or run into issues, please open an issue in the GitHub repository. We're here to help! |
| 100 | + |
| 101 | +Thank you for contributing to the Hacktoberfest Projects Finder! |
0 commit comments