|
1 | | -# share-secret |
| 1 | +# GhostSend - Secure Secret Sharing Platform |
| 2 | + |
| 3 | +A secure platform for sharing sensitive information with database encryption, automatic expiration, and view limits. Built with Nuxt.js 3 for the frontend and Go for the backend. |
| 4 | + |
| 5 | +## 🌟 Features |
| 6 | + |
| 7 | +- **Database Encryption**: All secrets are encrypted before storage |
| 8 | +- **Auto-Expiration**: Set expiration times (5 minutes to 7 days) |
| 9 | +- **View Limits**: Control how many times your secret can be viewed |
| 10 | +- **Password Protection**: Additional security layer with password protection |
| 11 | +- **Modern UI**: Responsive design with dark mode and animations |
| 12 | +- **Secure Backend**: Built with Go and PostgreSQL for robust data handling |
| 13 | + |
| 14 | +## 🏗️ Architecture |
| 15 | + |
| 16 | +### Frontend (Nuxt.js 3) |
| 17 | +- Modern, responsive UI built with Nuxt.js 3 |
| 18 | +- TailwindCSS for styling |
| 19 | +- Dark mode support |
| 20 | +- Animated components |
| 21 | +- Form validation |
| 22 | +- Clipboard integration |
| 23 | +- Error handling and notifications |
| 24 | + |
| 25 | +### Backend (Go) |
| 26 | +- RESTful API built with Gin framework |
| 27 | +- PostgreSQL database with migrations |
| 28 | +- Secure password hashing |
| 29 | +- Automatic cleanup of expired secrets |
| 30 | +- Health check endpoints |
| 31 | +- Structured logging with Zap |
| 32 | +- Dependency injection with Uber FX |
| 33 | + |
| 34 | +## 🚀 Getting Started |
| 35 | + |
| 36 | +### Prerequisites |
| 37 | +- Node.js (v22.9.0 or later) |
| 38 | +- Go (v1.23.4 or later) |
| 39 | +- Docker and Docker Compose |
| 40 | +- PostgreSQL (v17.0 or later) |
| 41 | + |
| 42 | +### Local Development |
| 43 | + |
| 44 | +1. Clone the repository: |
| 45 | +```bash |
| 46 | +git clone https://github.com/cksidharthan/ghost-send.git |
| 47 | +cd ghost-send |
| 48 | +``` |
| 49 | + |
| 50 | +2. Set up environment variables: |
| 51 | +```env |
| 52 | +# Frontend (.env) |
| 53 | +GHOST_SEND_API_URL=http://localhost:7780 |
| 54 | +
|
| 55 | +# Backend (.env) |
| 56 | +POSTGRES_HOST=localhost |
| 57 | +POSTGRES_PORT=5433 |
| 58 | +POSTGRES_USER=postgres |
| 59 | +POSTGRES_PASSWORD=postgres |
| 60 | +POSTGRES_DB=secret |
| 61 | +POSTGRES_SSL_MODE=disable |
| 62 | +PORT=7780 |
| 63 | +``` |
| 64 | + |
| 65 | +3. Start the development environment: |
| 66 | +```bash |
| 67 | +# Using Docker Compose |
| 68 | +docker-compose -f deploy/docker-compose.yaml up -d |
| 69 | + |
| 70 | +# Or start services individually: |
| 71 | + |
| 72 | +# Frontend |
| 73 | +cd frontend |
| 74 | +npm install |
| 75 | +npm run dev |
| 76 | + |
| 77 | +# Backend |
| 78 | +cd backend |
| 79 | +go mod download |
| 80 | +go run main.go |
| 81 | +``` |
| 82 | + |
| 83 | +The application will be available at: |
| 84 | +- Frontend: http://localhost:9090 |
| 85 | +- Backend: http://localhost:7780 |
| 86 | +- PostgreSQL: localhost:5433 |
| 87 | + |
| 88 | +## 🔧 Configuration |
| 89 | + |
| 90 | +### Frontend Configuration |
| 91 | +- `nuxt.config.ts`: Nuxt.js configuration with the following modules: |
| 92 | + - `@nuxt/ui` |
| 93 | + - `@nuxtjs/tailwindcss` |
| 94 | + - `@nuxtjs/color-mode` |
| 95 | + - `@nuxt/icon` |
| 96 | + - `@nuxt/image` |
| 97 | +- Environment variables: |
| 98 | + - `GHOST_SEND_API_URL`: Backend API URL |
| 99 | + |
| 100 | +### Backend Configuration |
| 101 | +- Database migrations in `backend/db/migrations` |
| 102 | +- Environment variables: |
| 103 | + - `POSTGRES_*`: Database configuration |
| 104 | + - `PORT`: API port |
| 105 | + - `LOG_LEVEL`: Logging level |
| 106 | + - `MIGRATION_PATH`: Path to database migrations |
| 107 | + |
| 108 | +## 📦 Deployment |
| 109 | + |
| 110 | +The project includes Docker configurations for easy deployment: |
| 111 | + |
| 112 | +```bash |
| 113 | +docker-compose -f deploy/docker-compose.yaml up -d |
| 114 | +``` |
| 115 | + |
| 116 | +This will start: |
| 117 | +1. PostgreSQL database (port 5433) |
| 118 | +2. Backend API service (port 7780) |
| 119 | +3. Frontend application (port 9090) |
| 120 | + |
| 121 | +### Production Build |
| 122 | + |
| 123 | +```bash |
| 124 | +# Frontend |
| 125 | +cd frontend |
| 126 | +npm run build |
| 127 | + |
| 128 | +# Backend |
| 129 | +cd backend |
| 130 | +go build -o secret main.go |
| 131 | +``` |
| 132 | + |
| 133 | +## 🔒 Security Features |
| 134 | + |
| 135 | +1. **Database Security** |
| 136 | + - Encrypted secret storage in PostgreSQL database |
| 137 | + - Automatic cleanup of expired secrets |
| 138 | + - Password hashing with bcrypt |
| 139 | + - Secure salt generation |
| 140 | + |
| 141 | +2. **API Security** |
| 142 | + - CORS protection |
| 143 | + - Input validation |
| 144 | + - Error handling |
| 145 | + - Secure password verification |
| 146 | + |
| 147 | +3. **Frontend Security** |
| 148 | + - XSS protection |
| 149 | + - Secure password handling |
| 150 | + - Client-side validation |
| 151 | + - Secure clipboard operations |
| 152 | + |
| 153 | +## 📝 API Endpoints |
| 154 | + |
| 155 | +- `GET /healthz`: Health check endpoint |
| 156 | +- `POST /secrets`: Create a new secret |
| 157 | + - Parameters: |
| 158 | + - `secret_text`: The text to encrypt |
| 159 | + - `password`: Access password |
| 160 | + - `expires_at`: Expiration time |
| 161 | + - `views`: Number of allowed views |
| 162 | +- `GET /secrets/:id`: Retrieve a secret |
| 163 | + - Parameters: |
| 164 | + - `id`: Secret UUID |
| 165 | + - `password`: Access password |
| 166 | +- `GET /secrets/:id/status`: Check secret status |
| 167 | + - Parameters: |
| 168 | + - `id`: Secret UUID |
| 169 | + |
| 170 | +## 🛠️ Development |
| 171 | + |
| 172 | +### Frontend Pages |
| 173 | +- `/`: Home page with secret creation form |
| 174 | +- `/access/:id`: Secret access page |
| 175 | +- `/about`: About page with feature information |
| 176 | + |
| 177 | +### Backend Structure |
| 178 | +- `cmd/`: Application entry point |
| 179 | +- `pkg/`: Main application packages |
| 180 | +- `db/`: Database migrations and queries |
| 181 | +- `deploy/`: Deployment configurations |
| 182 | + |
| 183 | +## 📚 Contributing |
| 184 | + |
| 185 | +1. Fork the repository |
| 186 | +2. Create your feature branch (`git checkout -b feature/AmazingFeature`) |
| 187 | +3. Commit your changes (`git commit -m 'Add some AmazingFeature'`) |
| 188 | +4. Push to the branch (`git push origin feature/AmazingFeature`) |
| 189 | +5. Open a Pull Request |
| 190 | + |
| 191 | +## 📄 License |
| 192 | + |
| 193 | +This project is licensed under the MIT License - see the LICENSE file for details. |
| 194 | + |
| 195 | +## 🙏 Acknowledgments |
| 196 | + |
| 197 | +- [Nuxt.js](https://nuxt.com/) |
| 198 | +- [Go](https://golang.org/) |
| 199 | +- [PostgreSQL](https://www.postgresql.org/) |
| 200 | +- [TailwindCSS](https://tailwindcss.com/) |
| 201 | +- [Gin](https://gin-gonic.com/) |
0 commit comments