Sceopa - an open source blogging platform

phoenix
#1

Hello!

I’ve created Sceopa, a free, open source blogging platform in Phoenix/Elixir. It allows anyone to sign up and create new blog posts in seconds. My aims are:

  • fast and responsive on all devices (my phone is super slow :weary:)
  • to allow quick creation of technical blog posts (markdown/syntax highlighting are supported)
  • minimal design (distraction-free articles)
  • clear and simple code
  • to learn from your feedback!

Sceopa is now live here.

The source code can be found on GitLab here.

I’m still quite new to Phoenix/Elixir so any feedback/tips/suggestions would be fantastic. Have some tips to improve the code? Or the UX? A new feature you want to see? Let me know! And feel free to submit issues/pull requests. :smiley:

Edit: And here’s an example post on the site so you can see what they look like.

9 Likes
Elixir language growth - the TIOBE index
Elixir blogging software
#2

First of all Congrats! on actually finishing a product and open sourcing it. I briefly read through the code base and tried out the product. Is this your first elixir app?

2 Likes
#3

Thanks. It’s my second Elixir app. I feel this is a lot cleaner than the first so I’m learning. :slight_smile:

1 Like
#4

I see! What are some of the challenges you faced learning elixir. What do you wish could be better?

1 Like
#5

Congrats! Do you have an example blog created with Sceopa?

1 Like
#6

Well as far as learning Elixir goes, I’ve been working through quite a few exercism exercises which have helped. I’m still very much a noob when it comes to OTP but am working through Elixir in Action to help with this. Overall I think there are a lot of good learning resources out there for the core language.

The two main difficulties I had were I guess the standard ones:

a) lack of libraries

e.g. For this project I wanted to have server-side syntax-highlighting. There are good libraries for this in python, haskell, and ruby, but not elixir (I ended up using Pandoc for this which is written in Haskell).

b) deployment

Setting up Heroku deployment and SSL was a bit of a pain, but mainly because I’m new to this. There are elixir/phoenix buildpacks for Heroku which are very helpful.

3 Likes
#7

Good idea!

I’ve added a (hastily!) written example article here.

2 Likes
#8

@tyro: Hey, I tried to register on yopmail temporary e-mail. I got message that e-mail was sent, but don’t get it in mailbox.

1 Like
#9

Hi, I use SendGrid for the emails, and it has tried to send an email to the yopmail address 4 times now. Each time it has been ‘deferred’ with a ‘Broken Pipe’ error. This could be because there is a problem with yopmail right now, or perhaps yopmail is possibly rejecting the activation messages if it believes they could be spam. Not sure, sorry!

Edit: it appears an email to another yopmail address was accepted by yopmail so not sure what happened with the first.

1 Like
#10

@tyro: Ok, I checked mail box one more time and I got a message. Looks like we need wait some time (don’t tested how long) for mail. Is it added to cron as a task or similar tool?

1 Like
#11

Use the force of Pattern Matching you much (or at least try ;))

https://gitlab.com/jameslong/sceopa/blob/master/web/models/user.ex#L95-102

above can be written as

defp put_email_key(%Ecto.Changeset{valid?: false} = changeset), do: changeset
defp put_email_key(%Ecto.Changeset{valid?: true} = changeset) do
  put_change(changeset, :email_verification_key, gen_email_key())
end
3 Likes
#12

@Eiji Activation emails are sent immediately. In your case, yopmail rejected the message a few times (presumably because yopmail had a problem).

ps. You can see the email sending code here.

And here’s the description on the Bamboo readme for that function:

By default delivering later uses Bamboo.TaskSupervisorStrategy. This strategy sends the email right away, but does so in the background without linking to the calling process, so errors in the mailer won’t bring down your app.

2 Likes
#13

@hlx Thanks. Most of my previous languages haven’t had function clauses so I often forget to do this!

1 Like
#14

Just an update, I’ve added support for uploading/download posts via JSON. For more info see here: https://sceopa.com/posts/17

ps. If anyone wants to look at the code for this feature (or code review it which would be awesome :slight_smile:) you can see the commit here: https://gitlab.com/jameslong/sceopa/commit/793fa9e39bb40415ee461e5aa0f9ac384ace54ba, the main function is:

  def import_posts(user, file) do
    with {:ok, contents} <- File.read(file.path),
         {:ok, %{"posts" => posts}} <- Poison.decode(contents),
         {:ok, _results} <-
           posts
           |> Enum.map(fn params ->
             assoc = build_assoc(user, :posts)
             Post.changeset(assoc, params)
           end)
           |> Enum.with_index()
           |> Enum.reduce(Multi.new(), fn {changeset, index}, multi ->
             Multi.insert(multi, index, changeset)
           end)
           |> Repo.transaction(),
      do: {:ok}
  end
4 Likes
#15

Well I just learned something

2 Likes
#16

Anywhere in particular you’d like me to send security issues?

Edit: That seems possibly harsh on it’s own, so to even it out: it’s a very nice project, and the codebase is really easy to understand. A great repo for beginners who want to see what an elixir project looks like!

1 Like
#17

Hey! I’d love to hear feedback on security issues. I’ve sent you a message. :slight_smile:

Edit: and don’t worry about sounding harsh, I’m still quite new to Elixir/Phoenix.

1 Like