Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
139 changes: 139 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Snowpack dependency directory (https://snowpack.dev/)
web_modules/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional stylelint cache
.stylelintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variable files
.env
.env.*
!.env.example

# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache

# Next.js build output
.next
out

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# vuepress v2.x temp and cache directory
.temp
.cache

# Sveltekit cache directory
.svelte-kit/

# vitepress build output
**/.vitepress/dist

# vitepress cache directory
**/.vitepress/cache

# Docusaurus cache and generated files
.docusaurus

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# Firebase cache directory
.firebase/

# TernJS port file
.tern-port

# Stores VSCode versions used for testing VSCode extensions
.vscode-test

# yarn v3
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions

# Vite logs files
vite.config.js.timestamp-*
vite.config.ts.timestamp-*
173 changes: 87 additions & 86 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,130 +1,131 @@
# Vi-Notes
# Vi-Notes Backend

**Vi-Notes** is an authenticity verification platform designed to distinguish genuine human-written content from AI-generated or AI-assisted text. The system focuses on analyzing **writing behavior** alongside **statistical and linguistic characteristics** of the text to establish reliable authorship verification.
This project implements a backend API for storing writing sessions and keystroke data as part of the Vi-Notes authenticity verification system. The system now uses MongoDB for persistent data storage.

This repository represents the **design and conceptual foundation** for the Vi-Notes system.
## Features

---
- Create writing sessions
- Retrieve stored sessions
- Delete sessions
- Store keystroke data (typing patterns)
- Persistent storage using MongoDB
- REST API using Express.js

## Motivation
---

With the widespread availability of AI writing tools, verifying true human authorship has become increasingly challenging. Most existing detection methods rely primarily on textual analysis, which can be inconsistent and easy to bypass.
## Tech Stack

Vi-Notes approaches this problem by combining:
- Behavioral signals from the writing process
- Statistical analysis of the written content
- Correlation between how content is written and what is written
- Node.js
- Express.js
- MongoDB
- Mongoose

---

## Core Idea

Human writing naturally includes:
- Variable typing speeds
- Pauses during thinking
- Revisions during idea formation
- Irregular sentence structures
- A relationship between content complexity and editing frequency

AI-generated or pasted text often lacks these behavioral signatures.
## Project Structure

Vi-Notes is designed to capture and analyze these characteristics to assess authorship authenticity.
vi-notes/
│── app.js
│── package.json
│── .env
│── README.md

---

## Key Features
## API Endpoints

### Writing Session Monitoring
- Capture keystroke timing metadata (not raw key content)
- Track pauses, deletions, edits, and writing flow
- Detect pasted or externally inserted text blocks
### GET /
Returns API status and available endpoints.

### Behavioral Pattern Analysis
- Pause distribution before sentences and paragraphs
- Typing speed variance
- Revision frequency relative to text complexity
- Micro-pauses around punctuation and structural boundaries
Response:
{
"message": "Vi-Notes Backend Running"
}

### Textual Statistical Analysis
- Sentence length variation
- Vocabulary diversity metrics
- Stylistic consistency analysis
- Linguistic irregularities typical of human writing

### Cross-Verification Engine
- Correlate keyboard behavior with text evolution
- Identify mismatches between behavioral data and content
- Flag suspicious uniformity patterns
---

### Authenticity Reports
- Confidence score for human authorship
- Highlighted suspicious segments
- Supporting behavioral and textual indicators
- Shareable verification summaries
### POST /session
Stores a new writing session in MongoDB.

Example Request:
{
"content": "Hello world",
"keystrokes": [
{ "key": "H", "time": 1 },
{ "key": "e", "time": 2 }
]
}

Response:
{
"message": "Session saved",
"data": {
"_id": "mongodb_id",
"content": "Hello world",
"keystrokes": [...]
}
}

---

## Tech Stack (MERN Architecture)
### GET /session
Retrieves all stored sessions from MongoDB.

### Frontend
- React
- TypeScript
- Electron for desktop-level keyboard event access
Response:
[
{
"_id": "mongodb_id",
"content": "Hello world",
"keystrokes": [...]
}
]

### Backend
- Node.js
- Express.js
- RESTful APIs for session handling and analysis
---

### Database
- MongoDB
- Encrypted storage for writing sessions, keystroke metadata, and reports
### DELETE /session/:id
Deletes a session by MongoDB ID.

### Machine Learning
- TensorFlow / PyTorch
- Supervised learning for human vs AI-assisted writing
- Unsupervised anomaly detection
- NLP-based statistical signature analysis
Response:
{
"message": "Session deleted"
}

---

## Privacy & Ethics
## How to Run

Vi-Notes is designed with privacy-first principles:
1. Install dependencies
npm install

- No storage of raw keystroke content
- Only timing, frequency, and structural metadata is collected
- Encrypted data storage
- User-controlled session tracking
- Monitoring limited strictly to active writing sessions
2. Create `.env` file

---
Add:
MONGO_URI=your_mongodb_connection_string
PORT=3000

## Project Goals
3. Start server
node app.js

- Restore trust in written content authenticity
- Differentiate between human-written, AI-assisted, and AI-generated text
- Adapt detection methods as AI writing tools evolve
- Maintain ethical, transparent, and privacy-conscious verification
4. Server runs on
http://localhost:3000

---

## Repository Scope
## Deployment

This repository currently serves as:
- A design reference
- A research and experimentation space
- A foundation for future MERN-based implementation
The backend is deployed on Render and uses environment variables for secure MongoDB connection.

---

## Contributing
## Future Improvements

Contributions are welcome, especially for **feature requests and their implementation**.
If you are interested in working on an existing feature request or proposing a new one, please open or comment on an issue to start the discussion.
- Add authentication (login/signup)
- Implement validation for input data
- Detect pasted text patterns
- Improve keystroke behavior analysis

---

## License
## Contribution Goal

This project is licensed under the MIT License.
This project focuses on building a scalable backend system for handling writing session data and keystroke tracking with database integration as part of the Vi-Notes platform.
Loading