https://github.com/teknologi-umum/polarite
a Pastebin alternative made for simplicity written in Go.
https://github.com/teknologi-umum/polarite
pastebin pastebin-api teknologi-umum
Last synced: 10 days ago
JSON representation
a Pastebin alternative made for simplicity written in Go.
- Host: GitHub
- URL: https://github.com/teknologi-umum/polarite
- Owner: teknologi-umum
- License: apache-2.0
- Created: 2021-10-04T14:23:12.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2025-03-30T22:01:17.000Z (25 days ago)
- Last Synced: 2025-03-30T23:18:33.781Z (25 days ago)
- Topics: pastebin, pastebin-api, teknologi-umum
- Language: Go
- Homepage: https://polarite.teknologiumum.com/?utm_source=github
- Size: 801 KB
- Stars: 12
- Watchers: 1
- Forks: 5
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: .github/CODE_OF_CONDUCT.md
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
- awesome-made-by-indonesian - Polarite - `a Pastebin alternative made for simplicity written in Go.` *by [Teknologi Umum](https://github.com/teknologi-umum)* (P)
- made-in-indonesia - Polarite - `a Pastebin alternative made for simplicity written in Go.` *by [Teknologi Umum](https://github.com/teknologi-umum)* (P)
- awesome-starred - teknologi-umum/polarite - a Pastebin alternative made for simplicity written in Go. (others)
README
![]()
---
## Usage
### API
Send a `POST` request to `https://polarite.teknologiumum.com` with:
- `Content-Type` header with the value of `text/plain`
- Non-empty `request body` consisting of the text you want to store
- `Authorization` header with the value of `Your Name ` with a minimum of 15 characters.Example request:
- cURL
```sh
curl \
-H "Content-Type: text/plain" \
-H "Authorization: John Doe " \
-X POST \
-d "Hello World" \
https://polarite.teknologiumum.com/
```- Javascript (via Fetch API)
```js
fetch("https://polarite.teknologiumum.com/", {
method: "POST",
headers: {
"Content-Type": "text/plain",
"Authorization": "John Doe "
},
body: "Hello world!"
})
```- Go
```go
import (
"net/http"
"strings"
)func Polarite() {
body := strings.NewReader("Hello world")
req, err := http.NewRequest(http.MethodPost, "https://polarite.teknologiumum.com/", body)
req.Header.Add("Content-Type", "text/plain")
req.Header.Add("Authorization", "John Doe ")client := &http.Client{}
resp, err := client.Do(req)
}
```- C#
```c#
using System.Net.Http;var client = new HttpClient();
var request = new HttpRequestMessage() {
RequestUri = new Uri("https://polarite.teknologiumum.com/"),
Method = HttpMethod.Post,
Headers = {
{ "Authorization", "John Doe " },
{ "ContentType", "text/plain" }
},
Content = new StringContent("Hello world", Encoding.UTF8, "text/plain")
};var task = await client.SendAsync(request);
```### Available Options
Polarite uses [alecthomas/chroma](github.com/alecthomas/chroma). You can pass
some options to the highlighter by appending these parameters in the URL.
If none of these options are passed, you will get a plain text without any highlighting- `lang`
This option decides which language to use. See [alecthomas/chroma#supported-languages](https://github.com/alecthomas/chroma/#supported-languages) for supported languages.
- `https://polarite.teknologiumum.com/your-unique-id?lang=go`
- `https://polarite.teknologiumum.com/your-unique-id?lang=rust`- `theme`
This option decides which theme to use. The default theme is dracula.
- `https://polarite.teknologiumum.com/your-unique-id?theme=monokai`
- `https://polarite.teknologiumum.com/your-unique-id?theme=nord`
Click here to see all valid themes- abap
- algol
- algol_nu
- arduino
- autumn
- base16-snazzy
- bw
- borland
- colorful
- doom-one
- doom-one2
- dracula
- emacs
- friendly
- fruity
- github
- hrdark
- hr_high_contrast
- igor
- lovelace
- manni
- monokai
- monokailight
- murphy
- native
- nord
- onesenterprise
- paraiso-dark
- paraiso-light
- pastie
- perldoc
- pygments
- rainbow_dash
- rrt
- solarized-dark
- soldarized-dark256
- solarized-light
- swapoff
- tango
- trac
- vim
- vs
- vulcan
- xcode
- xcode-dark
- `linenr`
This option decides whether to enable line number or not. A non empty value is considered as true.
- `https://polarite.teknologiumum.com/your-unique-id?linenr=yes`
- `https://polarite.teknologiumum.com/your-unique-id?linenr=true` This is also validYou can, of course, combine the options.
For example: `https://polarite.teknologiumum.com/your-unique-id?lang=rust&theme=nord&linenr=true`## Self-hosting Installation
We only provide Docker as a self-hosting option. You can build the image from source if you want it.
### Docker
```bash
docker run -d -p 3000:3000 ghcr.io/teknologi-umum/polarite:latest
```If you want to use the image from `master` branch, you can use `:edge` tag instead of `:latest`.
### Docker Compose
```yaml
services:
polarite:
image: ghcr.io/teknologi-umum/polarite:latest
ports:
- 3000:3000
environment:
ENVIRONMENT: production
PORT: 3000
TZ: UTC
SENTRY_DSN: ""
DATABASE_DIRECTORY: /app/data
healthcheck:
test: curl -f http://localhost:3000/ || exit 1
interval: 15s
timeout: 10s
retries: 5
```If you want to use the image from `master` branch, you can use `:edge` tag instead of `:latest`.
## Why the name, Polarite?
In the dawn of time, it began with the birth of [Graphene](https://github.com/teknologi-umum/graphene) repository, which its' name was picked from the name of a mineral.
Then, not so long after, another repository called [Flourite](https://github.com/teknologi-umum/flourite) emerged. It's actually a typo of Fluorite, another name of a mineral.
Now, where mankind stands, we want to continue that convention, to pick a name from a [list of mineral on Wikipedia](https://en.wikipedia.org/wiki/List_of_minerals).## License
```
Copyright 2025 Teknologi UmumLicensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License athttp://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
```See [LICENSE](./LICENSE)