Lobste.rs is open source: https://github.com/lobsters/lobsters
But anything more complex than a basic server seems like overkill for a simple text forum.