https://github.com/amirgamil/carly
Generate beautiful letters for your loved ones
https://github.com/amirgamil/carly
go javascript mongodb-atlas nextjs server-side
Last synced: about 1 year ago
JSON representation
Generate beautiful letters for your loved ones
- Host: GitHub
- URL: https://github.com/amirgamil/carly
- Owner: amirgamil
- Created: 2021-04-13T22:04:16.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2021-05-09T00:01:37.000Z (about 5 years ago)
- Last Synced: 2025-04-14T01:06:09.013Z (about 1 year ago)
- Topics: go, javascript, mongodb-atlas, nextjs, server-side
- Language: JavaScript
- Homepage: https://carly.amirbolous.com
- Size: 11.3 MB
- Stars: 15
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Security: security/encrypt.go
Awesome Lists containing this project
README
# Carly ✉️
#### Genereate beautiful letters for your loved ones that can be shared in seconds
Carly was written to help me send a birthday letter to my mum halfway around the world. Now anyone can do it too!




## Details
Carly is written in Next.js + React on the frontend (hosted on Vercel) and Go with MongoDB Atlas on the backend (hosted as a systemd file with nginx on Digital Ocean).
To run this locally, you will need to run the web server in Go (using `go run main.go`) as well as the frontend (navigate inside the frontend directory and run `yarn dev`).
You will also need a MongoDB atlas account (free tier M0 can be accessed by anyone). Once you've made an account, configure a user with admin access and store the username, password, and shared URL in a .env file with MONGO_USER, MONGO_PASS, MONGO_SHARD_URL as the variable names respectively. Make sure that this .env file is located in the same directory as the go.mod file.
You will also need to create a .env.local file inside the frontend folder and populate it with two variables
`NEXT_PUBLIC_HOST=localhost:3000
NEXT_PUBLIC_HOSTAPI=127.0.0.1:port/api`
You can select any port like 8998.
## API
The API provides two endpoints
### `POST /api`
- Accepts a JSON body that looks like this:
`{
"title": "titleLetter",
"expiry": "getExpiryDate()",
"password": "",
"content": [
{
"person": "person1",
"msg": "msg1",
"imgAdd": "imgAdd1"
},
{
"person":"person2",
"msg": "msg2",
"imgAdd": "imgAdd2"
}...
]
}`
The API returns the genereated hash if successful
`#200 OK
#{ "hash": "166989a"}`
### `GET /api/{hash}`
The API returns
`#401 Unauthorized` if the letter is password protected
OR
`#404 Bad request` if it does not find the hash in the database (or for any other possible error)
## Contributing
Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are **greatly appreciated**.
1. Fork the Project
2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)
3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)
4. Push to the Branch (`git push origin feature/AmazingFeature`)
5. Open a Pull Request
## Acknowledgements
* [Ctrl-v](https://github.com/jackyzha0/ctrl-v)
* [Block CSS](https://thesephist.github.io/blocks.css/)