Skip to content
A self-hosted single-user microblogging platform.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.idea
app
bootstrap
config
database
public
resources
routes
storage
tests
.editorconfig
.env.example
.gitattributes
.gitignore
README.md
artisan
composer.json
composer.lock
package-lock.json
package.json
phpunit.xml
server.php
webpack.mix.js
yarn.lock

README.md

Thinkery

This is a little self-hosted markdown microblogging platform I created for my personal use. I wanted to create something small and simple with Laravel that I could use as a Twitter replacement. There are only a few views: the login page, a page to create posts, an edit page, and an API view. Because I wanted to put posts on another site, there's no public posts page built in.

It should be apparent that this is a very specific hammer for a very specific wish that I had, and I'm not working on any features that don't fit my specific needs.

Things that don't work yet:

  • Local image uploads.
  • CSS for video embeds is totally wonky.
  • Possibly adding an "undelete" feature for posts and ability to view "deleted" posts in the user dashboard.

Setup

To run Thinkery, you'll need PHP, Composer, MySQL, and Apache or Nginx on your server. I'm going to assume that you either have all that set up or can get it set up on your machine.

Log into MySQL and create a new, empty database for your microblog.

Clone the repo.

git clone https://github.com/captainpainway/thinkery.git

Make a copy of .env.example as .env and update these variables:

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=[your database name]
DB_USERNAME=[your database username]
DB_PASSWORD=[your database passsword]

Now run composer install to install Laravel dependencies and run php artisan migrate to automatically create database tables.

Also, you'll want to run php artisan key:generate to generate an encryption key. This value will automatically be added to your .env file.

Now you can run php artisan serve and see Thinkery running on http://127/0/0/1:8080, but you can't log in yet. Ctrl+c out of your currently-running instance.

Creating users

I left account generation to the command line because I don't want any unauthorized users coming in and creating their own accounts on my personal microblog.

You can create a new user with php artisan user:create. It will ask you for a username, email address, and password. Each user must have a unique email address. You can create multiple users, and each user will have their own feed and API, but it's really best for this to be a one-user situation.

Once you have a user, you can use php artisan user:updatePassword to update the user's password, and php artisan user:delete to delete a user. These custom artisan commands can be found in /routes/console.php.

Now run php artisan serve again and see that you can login.

Now you can create posts, edit them with the edit button on each post, and delete posts as well. (Posts aren't completely deleted, you can manually switch the "deleted" flag on individual posts in the database if you're inclined to undelete something.)

You can also click the "API" link at the top right of the page to view the JSON generated by your posts, and use that JSON to create the front end view for your microblog.

Making it live with Nginx

Before setting up the server, we need to make sure that the Laravel is set to production. Open up your .env file and make these changes:

APP_NAME=thinkery
APP_ENV=production
APP_KEY=[this should've already been set with php artisan key:generate]
APP_DEBUG=false
APP_URL=[your domain name here]

Since I'm using Nginx on Ubuntu, I'll give a quick overview of setting up the server. You'll want to make sure you have php-fpm installed, and point to the php-fpm.sock file that corresponds to your version of PHP.

Create a new server block by copying the default in /etc/nginx/sites-available and symlink it in /etc/nginx/sites-enabled. Make the root directory point to the public directory wherever Thinkery is located.

Other configurations:

root /var/www/thinkery/public;

# Add index.php to the list if you are using PHP
index index.html index.html index.php;

location / {
    try_files $uri $uri/ /index.php?$args;
}

location ~ \.php$ {
    include snippets/fastcgi-php.conf;
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
}

Also make sure to change your server_name to your domain name.

Restart the server with sudo systemctl restart nginx and you should be able to pull up Thinkery by going to your domain name. If you get a Laravel error stating that your log file isn't writable, try changing the user by going to the root of your Thinkery project and running sudo chown -R www-data:www-data *.

Disclaimer

I'm not actively hacking on this much since I have it up and running (except for the image uploads), so I'm not interested in providing support or adding features at this time. Clone and fork at your own risk!

You can’t perform that action at this time.