Skip to content

Commit 740bc3b

Browse files
committed
prepare for public release
1 parent f24a392 commit 740bc3b

File tree

29 files changed

+861
-359
lines changed

29 files changed

+861
-359
lines changed

.env.example

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# FRONTEND
2+
NUXT_PUBLIC_GHOST_SEND_API_URL=
3+
4+
# BACKEND
5+
POSTGRES_HOST=
6+
POSTGRES_PORT=
7+
POSTGRES_USER=
8+
POSTGRES_PASSWORD=
9+
POSTGRES_DB=
10+
POSTGRES_DRIVER=
11+
POSTGRES_SSL_MODE=false
12+
MIGRATION_PATH=
13+
14+
# DATABASE
15+
POSTGRES_PASSWORD=
16+
POSTGRES_USER=
17+
POSTGRES_DB=

.github/workflows/docker.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Build and Push Docker Images
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v4
15+
16+
- name: Login to DockerHub
17+
uses: docker/login-action@v3
18+
with:
19+
username: ${{ secrets.DOCKERHUB_USERNAME }}
20+
password: ${{ secrets.DOCKERHUB_TOKEN }}
21+
22+
- name: Get version
23+
run: |
24+
VERSION=$(cat ${{ github.workspace }}/.version)
25+
echo "IMAGE_VERSION=$VERSION" >> $GITHUB_ENV
26+
27+
- name: Set up Docker Buildx
28+
uses: docker/setup-buildx-action@v3
29+
id: buildx
30+
31+
- name: Build and push Backend
32+
uses: docker/build-push-action@v5
33+
with:
34+
context: .
35+
file: deploy/Dockerfile-BE
36+
builder: ${{ steps.buildx.outputs.name }}
37+
platforms: linux/amd64
38+
push: true
39+
tags: |
40+
${{ secrets.DOCKERHUB_USERNAME }}/ghostsend-backend:${{ env.IMAGE_VERSION }}
41+
${{ secrets.DOCKERHUB_USERNAME }}/ghostsend-backend:latest
42+
43+
- name: Build and push Frontend
44+
uses: docker/build-push-action@v5
45+
with:
46+
context: .
47+
file: deploy/Dockerfile-FE
48+
builder: ${{ steps.buildx.outputs.name }}
49+
platforms: linux/amd64
50+
push: true
51+
tags: |
52+
${{ secrets.DOCKERHUB_USERNAME }}/ghostsend-frontend:${{ env.IMAGE_VERSION }}
53+
${{ secrets.DOCKERHUB_USERNAME }}/ghostsend-frontend:latest

.version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
v0.0.1

README.md

Lines changed: 201 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,201 @@
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/)

Taskfile.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,16 +77,16 @@ tasks:
7777
dir: deploy
7878
desc: Deploy the application
7979
cmds:
80-
- docker compose -f deploy/docker-compose.yaml up -d --build
80+
- docker compose -f docker-compose.yaml up -d --build
8181

8282
deploy-postgres:
8383
dir: deploy
8484
desc: Deploy the postgres database
8585
cmds:
86-
- docker compose -f deploy/docker-compose.yaml up -d postgres-secret
86+
- docker compose -f docker-compose.yaml up -d postgres-secret
8787

8888
down:
8989
dir: deploy
9090
desc: Down the application
9191
cmds:
92-
- docker compose -f deploy/docker-compose.yaml down
92+
- docker compose -f docker-compose.yaml down

backend/cmd/start.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
package cmd
22

33
import (
4-
"github.com/cksidharthan/share-secret/pkg/config"
5-
"github.com/cksidharthan/share-secret/pkg/daemon"
6-
"github.com/cksidharthan/share-secret/pkg/logger"
7-
"github.com/cksidharthan/share-secret/pkg/postgres"
8-
"github.com/cksidharthan/share-secret/pkg/router"
9-
secretHttp "github.com/cksidharthan/share-secret/pkg/secret/http"
10-
secretSvc "github.com/cksidharthan/share-secret/pkg/secret/svc"
4+
"github.com/cksidharthan/ghost-send/pkg/config"
5+
"github.com/cksidharthan/ghost-send/pkg/daemon"
6+
"github.com/cksidharthan/ghost-send/pkg/logger"
7+
"github.com/cksidharthan/ghost-send/pkg/postgres"
8+
"github.com/cksidharthan/ghost-send/pkg/router"
9+
secretHttp "github.com/cksidharthan/ghost-send/pkg/secret/http"
10+
secretSvc "github.com/cksidharthan/ghost-send/pkg/secret/svc"
1111
"go.uber.org/fx"
1212
)
1313

backend/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module github.com/cksidharthan/share-secret
1+
module github.com/cksidharthan/ghost-send
22

33
go 1.23.4
44

backend/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package main
22

33
import (
4-
"github.com/cksidharthan/share-secret/cmd"
4+
"github.com/cksidharthan/ghost-send/cmd"
55
_ "github.com/golang-migrate/migrate/v4/source/file"
66
_ "github.com/lib/pq"
77
)

backend/pkg/config/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ type Config struct {
1414
PostgresPort int `env:"POSTGRES_PORT" envDefault:"5433"`
1515
PostgresUser string `env:"POSTGRES_USER" envDefault:"postgres"`
1616
PostgresPassword string `env:"POSTGRES_PASSWORD" envDefault:"postgres"`
17-
PostgresDB string `env:"POSTGRES_DB" envDefault:"secret"`
17+
PostgresDB string `env:"POSTGRES_DB" envDefault:"ghostsend"`
1818
PostgresSSLMode string `env:"POSTGRES_SSL_MODE" envDefault:"disable"`
1919
MigrationsPath string `env:"MIGRATION_PATH" envDefault:"db/migrations"`
2020

backend/pkg/daemon/janitor.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"context"
55
"time"
66

7-
db "github.com/cksidharthan/share-secret/db/sqlc"
7+
db "github.com/cksidharthan/ghost-send/db/sqlc"
88
"go.uber.org/fx"
99
"go.uber.org/zap"
1010
)

0 commit comments

Comments
 (0)