Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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: 19 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.

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 endpoints

1. 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 & Running

To 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
```


Deplopyment

Just 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"


image

3. On the import git repository, select your react project (we have used vite here, but no issue with CRA), and simply click "Deploy"


image


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!


image


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.