https://github.com/vercetti322/textcache-backend
A simple, secure platform for storing and sharing text snippets with ease. Share your notes or code with customizable options like syntax highlighting, tags, and expiration times.
https://github.com/vercetti322/textcache-backend
docker java redis spring-boot
Last synced: 25 days ago
JSON representation
A simple, secure platform for storing and sharing text snippets with ease. Share your notes or code with customizable options like syntax highlighting, tags, and expiration times.
- Host: GitHub
- URL: https://github.com/vercetti322/textcache-backend
- Owner: vercetti322
- Created: 2024-09-08T12:25:56.000Z (10 months ago)
- Default Branch: master
- Last Pushed: 2024-09-11T09:30:16.000Z (10 months ago)
- Last Synced: 2025-04-05T21:43:19.721Z (3 months ago)
- Topics: docker, java, redis, spring-boot
- Language: Java
- Homepage: https://textcache-backend.onrender.com/
- Size: 201 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Textcache
![]()
Textcache is an alternative to Pastebin which allows for sharing of text snippets (with the option of password protection) in a safe manner. The text shared is end-to-end encrypted using AES encryption - check that out at
AES wiki. This repository has the backend code styled with Spring Boot framework. The
server is hosted at Server. A redis instance is also connected via internal URL hosted on render.
API endpoints1. Fetch encrypted paste JSON from frontend and put it into redis (TTL = 900s).
```http
POST /api/pastes/new
Content-Type: application/json
```
2. Send the same paste JSON with an automated path URL (where frontend will display the cache).
```http
GET /api/pastes/{hash}
Content-type: application/json
```
Following is how the encrypted json looks like (the data is encrypted so no privacy issue!)
```json
{
"encryptedContent" : "nJ0xYEAV+Dcpk9io5bBZS6lwopoj8YIpn7C/SPvBo/QNgHKLT7lBEXIZOnvXnC"
"iv" : "8d26b321261ee530d0be5dd389108995"
"protected" : true
"hash" : "xy12se"
}
```
Building & RunningTo build & run the project, u must have Java JDK installed on your favourite IDE (I recommend Intellij). Although u don't need to setup spring boot
project from scratch u can check out the general setup at spring initializer.Follow the below steps to run the project locally & subsequently build it too (not required for deployment tho)
``` bash
# clone the project to get local folder
git clone https://github.com/vercetti322/textcache-backend.git
```
After cloning, open the project in your IDE and let it resolve the pom.xml for maven dependencies (if it does not do it, then run
```mvn install``` in root directory of the project). After that you can build the project to get a ```.jar``` file.```bash
mvn build
```
DeplopymentJust head on to vercel and create a free tier account (mention that you are hobbyist student) until u get an empty dashboard.
Follow the below steps to deploy:1. Click on the "Add new" and select the option for "Project"
![]()
3. On the import git repository, select your react project (we have used vite here, but no issue with CRA), and simply click "Deploy"
![]()
5. Also, mention any environment variables (not in our case, i mentioned the base url of hosted server directly).6. Wait for some time untill the project builds and u get a live link!
![]()
Issues
This section talks about some issues u might run into while deploying:1. Make sure u have a vercel.json
which tells vercel to route back any dynamic routes (as in our case) to ```index.html```.2. If u get an ```npm run build error (exit 1)``` error then 99% u the ```index.html``` is not able to ref the ```main.jsx```. Other errors like capitalization of components, directory not having ```package.json```, etc. might also be the cause.