3 Commits

Author SHA1 Message Date
188d7bd2f3 docs: Added license and Code of Conduct
All checks were successful
Deploy Brew Application / deploy (push) Successful in 10s
2026-06-11 10:42:49 +05:30
a2d7b6f0b2 docs: fix formatting
All checks were successful
Deploy Brew Application / deploy (push) Successful in 12s
2026-06-11 10:34:52 +05:30
60d1e75177 docs: Add screenshots
All checks were successful
Deploy Brew Application / deploy (push) Successful in 12s
2026-06-11 10:34:05 +05:30
4 changed files with 186 additions and 17 deletions

128
CODE_OF_CONDUCT.md Normal file
View File

@@ -0,0 +1,128 @@
# Contributor Covenant Code of Conduct
## Our Pledge
We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, religion, or sexual identity
and orientation.
We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.
## Our Standards
Examples of behavior that contributes to a positive environment for our
community include:
- Demonstrating empathy and kindness toward other people
- Being respectful of differing opinions, viewpoints, and experiences
- Giving and gracefully accepting constructive feedback
- Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
- Focusing on what is best not just for us as individuals, but for the
overall community
Examples of unacceptable behavior include:
- The use of sexualized language or imagery, and sexual attention or
advances of any kind
- Trolling, insulting or derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or email
address, without their explicit permission
- Other conduct which could reasonably be considered inappropriate in a
professional setting
## Enforcement Responsibilities
Community leaders are responsible for clarifying and enforcing our standards of
acceptable behavior and will take appropriate and fair corrective action in
response to any behavior that they deem inappropriate, threatening, offensive,
or harmful.
Community leaders have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, and will communicate reasons for moderation
decisions when appropriate.
## Scope
This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.
Examples of representing our community include using an official e-mail address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
<mail@adityagupta.dev>.
All complaints will be reviewed and investigated promptly and fairly.
All community leaders are obligated to respect the privacy and security of the
reporter of any incident.
## Enforcement Guidelines
Community leaders will follow these Community Impact Guidelines in determining
the consequences for any action they deem in violation of this Code of Conduct:
### 1. Correction
**Community Impact**: Use of inappropriate language or other behavior deemed
unprofessional or unwelcome in the community.
**Consequence**: A private, written warning from community leaders, providing
clarity around the nature of the violation and an explanation of why the
behavior was inappropriate. A public apology may be requested.
### 2. Warning
**Community Impact**: A violation through a single incident or series
of actions.
**Consequence**: A warning with consequences for continued behavior. No
interaction with the people involved, including unsolicited interaction with
those enforcing the Code of Conduct, for a specified period of time. This
includes avoiding interactions in community spaces as well as external channels
like social media. Violating these terms may lead to a temporary or
permanent ban.
### 3. Temporary Ban
**Community Impact**: A serious violation of community standards, including
sustained inappropriate behavior.
**Consequence**: A temporary ban from any sort of interaction or public
communication with the community for a specified period of time. No public or
private interaction with the people involved, including unsolicited interaction
with those enforcing the Code of Conduct, is allowed during this period.
Violating these terms may lead to a permanent ban.
### 4. Permanent Ban
**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.
**Consequence**: A permanent ban from any sort of public interaction within
the community.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.0, available at
<https://www.contributor-covenant.org/version/2/0/code_of_conduct.html>.
Community Impact Guidelines were inspired by [Mozilla's code of conduct
enforcement ladder](https://github.com/mozilla/diversity).
[homepage]: https://www.contributor-covenant.org
For answers to common questions about this code of conduct, see the FAQ at
<https://www.contributor-covenant.org/faq>. Translations are available at
<https://www.contributor-covenant.org/translations>.

21
LICENSE Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2026 Aditya Gupta
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -24,20 +24,7 @@
## Screenshots
<p align="center">
<!-- Place your app screenshots here once available -->
<em>Screenshots coming soon!</em>
</p>
<!--
<p align="center">
<img src="path/to/dashboard.png" alt="Brew Journal Dashboard" width="800" />
</p>
<p align="center">
<img src="path/to/mobile_dashboard.png" alt="Mobile Dashboard View" width="280" style="margin-right: 10px;" />
<img src="path/to/brew_form.png" alt="Brew Logging View" width="280" />
</p>
-->
![screenshot](./docs/assets/screenshot.jpg)
## Features
@@ -51,6 +38,7 @@
## Architecture Overview
The codebase is split into two main sections:
- **Frontend**: A React application located in the root directory, built with [Vite](https://vite.dev/). Key files include:
- [package.json](file:///home/sortedcord/Projects/brew/package.json) (dependencies and scripts)
- [src/App.jsx](file:///home/sortedcord/Projects/brew/src/App.jsx) (routing and layout)
@@ -63,6 +51,7 @@ The codebase is split into two main sections:
## Prerequisites
Make sure you have the following installed on your system:
- **Node.js** (v18.x or higher recommended)
- **npm** (v9.x or higher)
- **PostgreSQL** (v14 or higher)
@@ -76,44 +65,54 @@ You need a running PostgreSQL database instance. Follow the steps below based on
#### Installing PostgreSQL
##### Linux (Debian/Ubuntu)
```bash
sudo apt update
sudo apt install postgresql postgresql-contrib
```
The PostgreSQL service should start automatically. If not, start it with:
```bash
sudo systemctl start postgresql
sudo systemctl enable postgresql
```
##### macOS (using Homebrew)
```bash
brew install postgresql
brew services start postgresql
```
##### Windows
Download and run the interactive installer from the [Official PostgreSQL Downloads page](https://www.postgresql.org/download/windows/).
##### Creating the Database and User
1. Log into the PostgreSQL interactive terminal as the superuser `postgres`:
```bash
sudo -i -u postgres psql
```
*(On macOS/Windows, open your terminal/command prompt and run `psql postgres` or use a graphical tool like PgAdmin).*
_(On macOS/Windows, open your terminal/command prompt and run `psql postgres` or use a graphical tool like PgAdmin)._
2. Create a database user with a secure password:
```sql
CREATE USER brew_user WITH PASSWORD 'your_secure_password';
```
3. Create the database and set its owner to `brew_user`. Setting the owner guarantees that the user has full table creation privileges on the default `public` schema:
```sql
CREATE DATABASE brew OWNER brew_user;
```
4. Exit the PostgreSQL shell:
```sql
\q
```
@@ -121,6 +120,7 @@ Download and run the interactive installer from the [Official PostgreSQL Downloa
> [!TIP]
> **Troubleshooting "Permission denied for schema public" (PostgreSQL 15+):**
> If you already created the database without setting `brew_user` as the owner and encounter this error, log in as the superuser (`postgres`), connect to the `brew` database, and explicitly grant the schema privileges:
>
> ```sql
> \c brew
> GRANT ALL ON SCHEMA public TO brew_user;
@@ -132,29 +132,36 @@ Download and run the interactive installer from the [Official PostgreSQL Downloa
### 2. Backend Setup
1. Navigate to the backend directory:
```bash
cd server
```
2. Create a [server/.env](file:///home/sortedcord/Projects/brew/server/.env) file by copying the template [server/.env.example](file:///home/sortedcord/Projects/brew/server/.env.example):
```bash
cp .env.example .env
```
3. Open [server/.env](file:///home/sortedcord/Projects/brew/server/.env) and configure the environment variables:
```env
PORT=5000
DATABASE_URL=postgresql://brew_user:your_secure_password@localhost:5432/brew
JWT_SECRET=your_jwt_secret_here
```
*Replace `your_secure_password` with the password you set during the database setup.*
_Replace `your_secure_password` with the password you set during the database setup._
4. Install dependencies and start the backend server:
```bash
npm install
npm start
```
The backend should start and display:
```text
Database initialized
Server running on port 5000
@@ -163,16 +170,19 @@ Download and run the interactive installer from the [Official PostgreSQL Downloa
### 3. Frontend Setup
1. Open a new terminal window/tab and navigate to the project root directory:
```bash
cd /home/sortedcord/Projects/brew
```
2. Install frontend dependencies:
```bash
npm install
```
3. Start the Vite development server:
```bash
npm run dev
```
@@ -184,17 +194,20 @@ Download and run the interactive installer from the [Official PostgreSQL Downloa
When deploying the Brew application to a production environment, follow these guidelines for security, reliability, and performance:
### 1. Database (PostgreSQL)
- **Restricted Access**: Do not use superuser accounts (such as `postgres`) for backend application connections. Instead, use a restricted role with standard read/write permissions.
- **Managed Databases**: Use a managed database service (e.g., Supabase, Neon, AWS RDS, GCP Cloud SQL) to leverage automated backups, scaling, and high-availability.
- **SSL Connection**: Enforce encrypted database connections by appending SSL options to the connection string (e.g., `?sslmode=require`).
### 2. Backend Server Setup
- **Environment Variables**: In your production environment, set the following environment variables:
- `NODE_ENV=production`
- `PORT=8080` (or whichever port is provided by your host)
- `DATABASE_URL=postgresql://<db_user>:<db_password>@<db_host>:<db_port>/<db_name>?sslmode=require`
- `JWT_SECRET=your_long_random_production_secret` (generate a secure 32-byte key using `openssl rand -base64 32`)
- **Process Management**: Use a process manager like **PM2** to run the backend node process, keep it alive, and handle automatic clustering or restarts:
```bash
# Install PM2 globally
npm install -g pm2
@@ -202,20 +215,27 @@ When deploying the Brew application to a production environment, follow these gu
# Start the backend server
pm2 start server/index.js --name "brew-backend"
```
- **Restrict CORS**: In [server/index.js](file:///home/sortedcord/Projects/brew/server/index.js), configure the `cors` middleware to only accept requests from your frontend production domain:
```javascript
app.use(cors({ origin: 'https://yourfrontenddomain.com' }));
app.use(cors({ origin: "https://yourfrontenddomain.com" }));
```
### 3. Frontend Build & Hosting
- **Build the static bundle**: Run the build script in the root directory to generate optimized production assets:
```bash
npm run build
```
This generates static HTML, CSS, and JS files in the `dist/` directory.
- **Hosting**:
- Deploy the static files from the `dist/` directory to static hosting platforms like **Vercel**, **Netlify**, **Cloudflare Pages**, or **AWS S3/CloudFront**.
- Alternatively, if using a VPS, serve the `dist/` directory using **Nginx** and proxy API traffic:
```nginx
server {
listen 80;

BIN
docs/assets/screenshot.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 175 KiB