Effortless Sticky Notes with Smart Alerts & Customization!
Report Bug
Β·
Request Feature
.
Contribute
.
Pull Requests
.
Report Security Issue
.
Fork the Project
Table of Contents
Scribly is a modern sticky note web app designed to enhance productivity and organization. With a sleek and intuitive interface, it allows users to effortlessly add, edit, delete, and organize notes.
- π Google Authentication β Secure authentication using OAuth2 with Passport.js
- π Push Notifications β Send real-time alerts using Web Push API
- π‘οΈ Data Sanitization β Prevent XSS attacks with DOMPurify and JSDOM
- π JWT Authentication β Secure user sessions with JSON Web Tokens (JWT)
- π Automated Tasks β Schedule background jobs with Node-Cron
- π Session Management β Handle user sessions efficiently with Express-Session
- ποΈ PostgreSQL Database β Store and manage data with pg (node-postgres)
- π CORS Support β Secure cross-origin requests with CORS middleware
- π Markdown Parsing β Render and sanitize user-generated content with Marked.js
Powered by robust backend technologies for seamless performance and security.
Get started quickly with these easy setup instructions.
Before setting up the project, ensure you have the following installed:
- Node.js β Download Node.js (LTS version recommended)
- PostgreSQL β Install and configure PostgreSQL for database management (Download PostgreSQL)
- npm or Yarn β Comes with Node.js; used to install project dependencies
- Git β Download Git to clone the repository
- Railway Account β If deploying on Railway, create a free account at Railway
- Google Cloud Project β Set up a Google Cloud project for Google Authentication (Guide)
- Web Push API Keys β Generate keys for enabling push notifications (Web Push Guide)
- Environment Variables β Create a
.envfile and configure the required variables (see.env.example)
Additionally, having a basic understanding of the following will be helpful:
- Express.js β For handling API requests efficiently
- JWT Authentication β Secure user authentication using JSON Web Tokens
- Node-Cron β For scheduling background tasks
Follow these steps to set up the project locally:
- Clone the Repository
git clone https://github.com/akash85246/Scribly-backend.git cd Scribly - Install Dependencies
npm install
- Set Up Environment Variables
# Server Configuration PORT=5001 BASE_URL=http://localhost:5001 FRONTEND_URL=http://localhost:5174 # Database Configuration DB_HOST=your_database_host DB_PORT=your_database_port DB_USER=your_database_user DB_PASSWORD=your_database_password DB_DATABASE=your_database_name DB_SSL=true # Set to "true" if using SSL, otherwise "false" # Session Secret (for Express session) SESSION_SECRET=your_random_session_secret # Google OAuth Credentials GOOGLE_CLIENT_ID=your_google_client_id GOOGLE_CLIENT_SECRET=your_google_client_secret # JWT Secret (for authentication) JWT_SECRET=your_jwt_secret # Admin Configuration ADMIN_EMAIL=your_admin_email # Web Push Notifications (VAPID Keys) WEB_PUSH_PUBLIC_KEY=your_web_push_public_key WEB_PUSH_PRIVATE_KEY=your_web_push_private_key
- Change git remote url to avoid accidental pushes to base project
git remote set-url origin github_username/repo_name git remote -v # confirm the changes - Run the Project
npm start
Once the backend is running, it provides the following functionalities:
- Supports Google OAuth for secure sign-in.
- Generates and manages user sessions using JWT tokens.
- Uses Express sessions for handling persistent login states.
- Create Notes: Users can add new notes with a title, content, and optional alert.
- Edit Notes: Allows users to update the content of existing notes.
- Delete Notes: Users can remove notes they no longer need.
- Sends real-time push notifications for alerts using
web-push. - Users receive notifications when a note's alert time is triggered.
- Uses JWT-based authentication for secure API access.
- Implements session handling with
express-sessionto manage login states. - Users can log out securely, clearing their sessions.
- PostgreSQL is used as the primary database.
- Data is securely stored with optional SSL support for remote connections.
- Uses Knex.js for query building and database transactions.
- Supports sorting and filtering of notes by:
- Title
- Content
- Creation date
- Alert date
- Implements CORS policies to prevent unauthorized cross-origin requests.
- Uses DOMPurify & jsdom to sanitize user inputs, preventing XSS attacks.
- Supports JWT token-based API authentication for secure access.
- Database Setup: Ensure that PostgreSQL is running and the
.envfile is correctly configured. - Environment Variables: Modify the
.envfile to set up API keys, database credentials, and authentication secrets. - Deployment: Can be deployed on Railway, Render, or any cloud-based Node.js server.
- Frontend Integration: This backend is designed to work with the Scribly frontend application.
Here are the planned improvements and features for the backend:
- User Authentication β Implement Google OAuth login.
- JWT-based Authentication β Secure API access using JSON Web Tokens.
- Session Management β Maintain user sessions with
express-session. - Sticky Note API β Enable adding, editing, and deleting notes.
- Push Notifications β Implement
web-pushfor real-time alerts. - Database Integration β Store and manage data with PostgreSQL.
- Security Enhancements β Implement CORS, input sanitization, and session protection.
- Deployment Readiness β Prepare for cloud deployment on Railway or other platforms.
See the open issues for a full list of proposed features (and known issues).
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
-
Fork the Project
- Click the "Fork" button at the top-right corner of this page to create a copy of the repository in your GitHub account.
-
Clone the Repository
- Clone your forked repository to your local machine:
git clone https://github.com/your-username/Scribly-backend.git
- Clone your forked repository to your local machine:
-
Create Your Feature Branch
- Navigate to your project folder and create a new branch for your feature:
git checkout -b feature/AmazingFeature
- Navigate to your project folder and create a new branch for your feature:
-
Commit Your Changes
- After making the necessary changes, commit them:
git commit -m 'Add some AmazingFeature'
- After making the necessary changes, commit them:
-
Push to the Branch
- Push your changes to your forked repository:
git push origin feature/AmazingFeature
- Push your changes to your forked repository:
-
Open a Pull Request
- Go to the original repository (
akash85246/Scribly), and open a pull request to merge your feature branch into themainbranch. - Provide a brief description of the changes you've made and submit the pull request for review.
- Go to the original repository (
Akash Rajput - @akash_rajp91025 - [email protected]
Project Link: https://github.com/akash85246/Scribly-backend
I would like to extend my gratitude to the following resources and technologies that made this project possible:
- Google Authentication β For enabling secure OAuth-based user authentication.
- PostgreSQL β For offering a reliable and scalable database solution.
- Node.js & Express.js β For powering the backend and handling API requests efficiently.
- Passport.js β For simplifying authentication and session management.
- JSON Web Token (JWT) β For secure user authentication and API access control.
- Web Push API β For enabling push notifications and real-time alerts.
- Node-Cron β For scheduling background tasks and automated reminders.
- Dompurify & JSDOM β For ensuring safe and sanitized HTML handling.
- MDN & DevDocs β For providing excellent documentation and learning resources.
- Open Source Community β For their contributions to the tools and libraries that made this backend possible.
