Skip to content

Gupta-02/TEXT-VAULT

Repository files navigation

TEXT-RETRIVER

πŸ›οΈ TextVault - Secure Text File Storage

A modern, full-stack web application for securely storing and managing encrypted text files in the cloud.

Star on GitHub


πŸ“Œ Important Notice

πŸ‘‰ For the latest version and active development, please visit:

TEXT-RETRIVER Repository πŸ”—

This repository (Gupta/TextVault) has been superseded. Please use the link above for the most up-to-date version.


Next.js React MongoDB Tailwind CSS License


πŸ“‹ Table of Contents


✨ Features

  • πŸ” Password-Protected Files - Secure your text files with bcrypt encryption
  • πŸ“ File Management - Create, view, and manage multiple text files
  • ☁️ Cloud Storage - Store files securely on MongoDB Atlas
  • 🎨 Modern UI - Beautiful, responsive interface with Framer Motion animations
  • ⚑ Real-time Updates - Instant file synchronization
  • 🎯 Fast Performance - Optimized with Next.js and React 19
  • πŸ“± Mobile Responsive - Works seamlessly on all devices

πŸ› οΈ Tech Stack

Frontend

  • Framework: Next.js 15.0.3
  • UI Library: React 19.0 RC
  • Styling: Tailwind CSS + TailwindCSS Animate
  • Animations: Framer Motion
  • Components: Radix UI
  • Icons: Lucide React + React Icons
  • Notifications: React Toastify

Backend

  • Runtime: Node.js
  • Database: MongoDB Atlas
  • Authentication: Bcrypt
  • ORM: Mongoose

Development Tools

  • Package Manager: npm
  • Code Editor: VS Code (recommended)
  • Build Tool: Next.js Built-in

πŸ—οΈ Project Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    TEXTVAULT APPLICATION                    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                              β”‚
                β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                β”‚                           β”‚
          β”Œβ”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”            β”Œβ”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”
          β”‚  Frontend   β”‚            β”‚   Backend   β”‚
          β”‚  (Next.js)  β”‚            β”‚  (Node.js)  β”‚
          β””β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜            β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜
                β”‚                          β”‚
    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”          β”‚
    β”‚           β”‚              β”‚          β”‚
β”Œβ”€β”€β”€β–Όβ”€β”€β”€β”  β”Œβ”€β”€β”€β–Όβ”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”    β”‚
β”‚ Pages β”‚  β”‚ Comp.  β”‚  β”‚  Actions β”‚    β”‚
β”‚ (JSX) β”‚  β”‚ (UI)   β”‚  β”‚(Server)  β”‚    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜    β”‚
                             β”‚          β”‚
                        β”Œβ”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”
                        β”‚   Mongoose ORM     β”‚
                        β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                             β”‚
                        β”Œβ”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                        β”‚  MongoDB Atlas    β”‚
                        β”‚   (Cloud DB)      β”‚
                        β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸš€ Getting Started

Prerequisites

  • Node.js (v18 or higher)
  • npm or yarn
  • MongoDB Atlas Account
  • Git

Installation

  1. Clone the repository

    git clone https://github.com/Gupta-02/TEXT-RETRIVER.git
    cd TextVault
  2. Install dependencies

    npm install --legacy-peer-deps
  3. Set up environment variables

    • Create a .env.local file in the root directory
    • Add your MongoDB Atlas URI:
    MONGO_URI=mongodb+srv://username:password@cluster.mongodb.net/textvault?retryWrites=true&w=majority
  4. Start the development server

    npm run dev
  5. Open in browser

MongoDB Atlas Setup

Quick Setup Guide:

  1. Visit mongodb.com/cloud/atlas
  2. Create a free account
  3. Create a cluster (M0 free tier)
  4. Create a database user with username & password
  5. Allow network access (allow all IPs for development)
  6. Copy the connection string and add it to .env.local

πŸ“Š Workflow

User Journey Flow

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    USER INTERACTION FLOW                     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
     β”‚   User Opens   β”‚
     β”‚   Application  β”‚
     β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜
              β”‚
              β–Ό
     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
     β”‚  Homepage /    β”‚
     β”‚   Dashboard    β”‚
     β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜
              β”‚
       β”Œβ”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”
       β”‚             β”‚
       β–Ό             β–Ό
  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
  β”‚ Create  β”‚  β”‚ View/Access  β”‚
  β”‚ File    β”‚  β”‚ Existing     β”‚
  β”‚ (Drop)  β”‚  β”‚ Files        β”‚
  β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜
       β”‚               β”‚
       β–Ό               β–Ό
  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
  β”‚ Input File   β”‚  β”‚ Enter Password  β”‚
  β”‚ Content &    β”‚  β”‚ & View Content  β”‚
  β”‚ Set Password β”‚  β”‚                 β”‚
  β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜
       β”‚                      β”‚
       β–Ό                      β–Ό
  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
  β”‚ Encrypt with β”‚  β”‚ Decrypt Content  β”‚
  β”‚ Bcrypt       β”‚  β”‚ Using Password   β”‚
  β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜
       β”‚                       β”‚
       β–Ό                       β–Ό
  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
  β”‚ Save to      β”‚  β”‚ Display File     β”‚
  β”‚ MongoDB      β”‚  β”‚ Content          β”‚
  β”‚ Atlas        β”‚  β”‚                  β”‚
  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Data Flow Diagram

Frontend Request
       β”‚
       β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Next.js Server      β”‚
β”‚  Action Handler      β”‚
β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
       β”‚
       β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Mongoose Models     β”‚
β”‚  (TextFile Schema)   β”‚
β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
       β”‚
       β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Bcrypt Hashing      β”‚
β”‚  (Password Security) β”‚
β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
       β”‚
       β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  MongoDB Query       β”‚
β”‚  (CRUD Operations)   β”‚
β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
       β”‚
       β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Database Response   β”‚
β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
       β”‚
       β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  JSON Response       β”‚
β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
       β”‚
       β–Ό
Frontend UI Update

πŸ”Œ API Endpoints

Server Actions (Next.js)

Create File

addTextFile(text, textName, password)
- Parameters: File content, filename, password
- Returns: Success status with message
- Security: Password is hashed with bcrypt

View File

getTextFile(filename, password)
- Parameters: Filename, password
- Returns: File content if password matches
- Security: Uses bcrypt comparison

List Files

getAllTextFiles()
- Returns: Array of all filenames (without content)

Delete File

deleteTextFile(filename)
- Parameters: Filename to delete
- Returns: Success status

πŸ“ Project Structure

TextVault/
β”œβ”€β”€ public/                      # Static assets
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ app/
β”‚   β”‚   β”œβ”€β”€ layout.js           # Root layout component
β”‚   β”‚   β”œβ”€β”€ page.js             # Home page
β”‚   β”‚   β”œβ”€β”€ globals.css         # Global styles
β”‚   β”‚   β”œβ”€β”€ drop/
β”‚   β”‚   β”‚   └── page.jsx        # File upload page
β”‚   β”‚   └── view/
β”‚   β”‚       └── page.jsx        # File view page
β”‚   β”œβ”€β”€ components/
β”‚   β”‚   └── ui/
β”‚   β”‚       β”œβ”€β”€ button.jsx      # Button component
β”‚   β”‚       β”œβ”€β”€ input.jsx       # Input component
β”‚   β”‚       β”œβ”€β”€ dialog.jsx      # Modal component
β”‚   β”‚       β”œβ”€β”€ blur-in.jsx     # Blur animation
β”‚   β”‚       β”œβ”€β”€ shimmer-button.jsx  # Shimmer effect
β”‚   β”‚       └── ...             # Other UI components
β”‚   β”œβ”€β”€ actions/
β”‚   β”‚   └── index.js            # Server actions (CRUD)
β”‚   β”œβ”€β”€ lib/
β”‚   β”‚   β”œβ”€β”€ connectDb.js        # MongoDB connection
β”‚   β”‚   └── utils.js            # Utility functions
β”‚   └── Models/
β”‚       └── TextFile.js         # MongoDB schema
β”œβ”€β”€ .env.local                   # Environment variables (git ignored)
β”œβ”€β”€ .gitignore                   # Git ignore rules
β”œβ”€β”€ package.json                 # Dependencies
β”œβ”€β”€ tailwind.config.js           # Tailwind configuration
β”œβ”€β”€ next.config.mjs              # Next.js configuration
└── README.md                    # This file

🎯 Key Features Explained

πŸ” Password Security

  • Passwords are hashed using bcrypt (not stored as plain text)
  • Each file can have a unique password
  • Secure comparison prevents timing attacks

πŸ“¦ State Management

  • Uses Next.js Server Actions for backend logic
  • React hooks for frontend state
  • MongoDB for persistent storage

🎨 UI/UX

  • Responsive Design: Works on mobile, tablet, desktop
  • Animations: Smooth transitions with Framer Motion
  • Accessible Components: Built with Radix UI
image

πŸ“ Available Scripts

# Start development server
npm run dev

# Build for production
npm build

# Start production server
npm start

# Run linting
npm lint

🌍 Environment Variables

Create a .env.local file:

# MongoDB Atlas Connection
MONGO_URI=mongodb+srv://username:password@cluster.mongodb.net/textvault?retryWrites=true&w=majority

Never commit .env.local to git! It's already in .gitignore


πŸ“š Dependencies

  • next: 15.0.3 - React framework
  • react: 19.0.0-rc - UI library
  • mongodb: Cloud database
  • mongoose: ODM for MongoDB
  • bcrypt: Password hashing
  • tailwindcss: Utility-first CSS
  • framer-motion: Animation library
  • radix-ui: Accessible components
  • react-toastify: Notifications

πŸš€ Deployment

Deploy on Vercel (Recommended)

  1. Push your code to GitHub
  2. Visit vercel.com
  3. Import your repository
  4. Add environment variables
  5. Click Deploy

Deploy on Other Platforms

  • Netlify
  • Railway
  • Heroku
  • AWS

🀝 Contributing

Contributions are welcome!

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/AmazingFeature)
  3. Commit changes (git commit -m 'Add AmazingFeature')
  4. Push to branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.


πŸ‘¨β€πŸ’» Author

Gupta - GitHub Profile


πŸ™ Acknowledgments

  • Next.js team for the amazing framework
  • MongoDB for cloud database
  • Tailwind CSS for beautiful styling
  • All open-source contributors

πŸ“ž Support

If you have any questions or issues:

  1. Check existing Issues
  2. Create a new Issue with detailed information
  3. Contact the maintainer

Made with ❀️ by Gupta

⭐ Star this repo if you found it helpful!

About

Full-stack web application for securely storing and managing encrypted text files in the cloud.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published