https://github.com/jackyzha0/ctrl-v
📋 a modern, open-source pastebin with latex and markdown rendering support
https://github.com/jackyzha0/ctrl-v
go nextjs open-source pastebin react vercel
Last synced: about 11 hours ago
JSON representation
📋 a modern, open-source pastebin with latex and markdown rendering support
- Host: GitHub
- URL: https://github.com/jackyzha0/ctrl-v
- Owner: jackyzha0
- Archived: true
- Created: 2020-05-09T18:36:39.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2023-07-09T22:05:15.000Z (almost 2 years ago)
- Last Synced: 2024-11-08T10:47:25.539Z (5 months ago)
- Topics: go, nextjs, open-source, pastebin, react, vercel
- Language: JavaScript
- Homepage: https://ctrl-v.app/
- Size: 912 KB
- Stars: 118
- Watchers: 3
- Forks: 6
- Open Issues: 17
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- starred - jackyzha0/ctrl-v - 📋 a modern, open-source pastebin with latex and markdown rendering support (JavaScript)
- open-production-web-projects - ctrl-v - a modern, open-source pastebin with latex and markdown rendering support (Go / AWS Amplify)
- awesome-starred - jackyzha0/ctrl-v - 📋 a modern, open-source pastebin with latex and markdown rendering support (go)
README
# ctrl-v
### A modern, open-source pastebin with latex and markdown rendering support
Frontend is in React + Next.js and backend is in Go. Deployed via Vercel and Google Cloud Run.


## Public API
The ctrl-v API is provided for free for other developers to easily develop on top of it. It can be reached at `https://api.ctrl-v.app/`.### `GET /health`
```bash
# get the health of the API
curl https://api.ctrl-v.app/health# 200 OK
# > "status ok"
```### `POST /api`
```bash
# create a new paste
curl -L -X POST 'https://api.ctrl-v.app/api' \
-F 'expiry=2021-03-09T01:02:43.082Z' \
-F 'content=print(\"test content\")' \
-F 'title=test paste' \
-F 'language=python'# or with a password
curl -L -X POST 'https://api.ctrl-v.app/api' \
-F 'expiry=2021-03-09T01:02:43.082Z' \
-F 'content=print(\"test content\")' \
-F 'title=test paste' \
-F 'language=python' \
-F 'password=hunter2'# 200 OK
# > { "hash": "6Z7NVVv" }# 400 BAD_REQUEST
# happens when title/body is too long, password couldnt
# be hashed, or expiry is not in RFC3339 format
```
### `GET /api/{hash}`
```bash
# get unprotected hash
curl https://api.ctrl-v.app/api/1t9UybX# 200 OK
# > {
# > "content": "print(\"test content\")",
# > "expiry": "2021-03-09T01:02:43.082Z",
# > "language": "python",
# > "timestamp": "2021-03-02T01:06:16.209501971Z",
# > "title": "test paste"
# > }# 401 BAD_REQUEST
# happens when paste is password protected. when this happens, try the authenticated alternative using POST
# 404 NOT_FOUND
# no paste with that ID found
```### `POST /api/{hash}`
```bash
# get unprotected hash
curl -L -X POST 'https://api.ctrl-v.app/api/1t9UybX' \
-F 'password=hunter2'# 200 OK
# > {
# > "content": "print(\"test content\")",
# > "expiry": "2021-03-09T01:02:43.082Z",
# > "language": "python",
# > "timestamp": "2021-03-02T01:06:16.209501971Z",
# > "title": "test paste"
# > }# 401 BAD_REQUEST
# wrong password
# 404 NOT_FOUND
# no paste with that ID found
```## Developing
when doing local backend development, make sure you change the backend address to be localhost. You can find this on Line 4 of `frontend/src/http/shared.js`### Common
`make dev` — starts React development server on `:3000` and backend on `:8080`### Frontend
`make fe-run` — starts React development server on `:3000``make fe-build` — builds development release of frontend in `frontend/build`
### Backend
`make run` — starts backend on `:8080``make lint` — lints all Go files
`make docker-build` — builds Docker image of current backend
`make docker-run` — runs built Docker image on `:8080`